-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
85 lines (66 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
CC = gcc
CFLAGS =
LDFLAGS = -lm -lSDL2
PREFIX = /usr
WANT_DEBUG=TRUE
NAME = nosefart
VERSION = 3.0.0
BUILDTOP = nsfobj
BUILDDIR = $(BUILDTOP)/build
SRCDIR = src
CFLAGS += -DNSF_PLAYER
ifeq "$(WANT_DEBUG)" "TRUE"
CFLAGS += -ggdb
else
CFLAGS += -O2 -fomit-frame-pointer -ffast-math -funroll-loops
DEBUG_OBJECTS =
endif
CFLAGS +=\
-I$(SRCDIR)\
-I$(SRCDIR)/linux\
-I$(SRCDIR)/sndhrdw\
-I$(SRCDIR)/machine\
-I$(SRCDIR)/cpu/nes6502\
-I$(BUILDTOP)\
-I/usr/local/include/
NSFINFO_CFLAGS = $(CFLAGS) -DNES6502_MEM_ACCESS_CTRL
FILES =\
log\
memguard\
cpu/nes6502/nes6502\
cpu/nes6502/dis6502\
machine/nsf\
sndhrdw/nes_apu\
sndhrdw/vrcvisnd\
sndhrdw/fmopl\
sndhrdw/vrc7_snd\
sndhrdw/mmc5_snd\
sndhrdw/fds_snd
SRCS = $(addsuffix .c, $(FILES) linux/main_linux nsfinfo)
SOURCES = $(addprefix $(SRCDIR)/, $(SRCS))
OBJECTS = $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SOURCES))
ALL_OBJECTS = $(OBJECTS)
ALL_TARGETS = $(BUILDTOP)/$(NAME)
all: $(ALL_TARGETS)
$(BUILDDIR):
mkdir -p $(sort $(dir $(ALL_OBJECTS)))
$(BUILDTOP)/config.h: $(BUILDDIR)
echo "[$@]"
echo "#define VERSION \"$(VERSION)\"" > $@
echo "#define NAME \"$(NAME)\"" >> $@
$(BUILDDIR)/dep: $(BUILDTOP)/config.h
$(CC) $(NSFINFO_CFLAGS) $(CFLAGS) -M $(SOURCES) > $@
-include $(BUILDDIR)/dep/
install: all
mkdir -p $(PREFIX)/bin
cp $(ALL_TARGETS) $(PREFIX)/bin
uninstall:
rm -f $(PREFIX)/bin/$(NAME)
clean:
rm -rf nsfobj
$(BUILDTOP)/$(NAME): $(OBJECTS)
mkdir -p $(sort $(dir $(ALL_OBJECTS)))
$(CC) $(NSFINFO_CFLAGS) -o $@ $^ $(LDFLAGS)
$(BUILDDIR)/%.o: $(SRCDIR)/%.c $(BUILDTOP)/config.h
mkdir -p $(sort $(dir $(ALL_OBJECTS)))
$(CC) $(NSFINFO_CFLAGS) -o $@ -c $<