-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathMakefile
86 lines (62 loc) · 2.03 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
86
include config.mk
cflags := -Isrc/brogue -Isrc/platform -std=c99 \
-Wall -Wpedantic -Werror=implicit -Wno-parentheses -Wno-unused-result -Wno-format
libs := -lm
cppflags := -DDATADIR=$(DATADIR)
sources := $(wildcard src/brogue/*.c) $(addprefix src/platform/,main.c platformdependent.c)
ifeq ($(TERMINAL),YES)
sources += $(addprefix src/platform/,curses-platform.c term.c)
cppflags += -DBROGUE_CURSES
libs += -lncurses
endif
ifeq ($(GRAPHICS),YES)
sources += $(addprefix src/platform/,sdl2-platform.c)
cflags += $(shell $(SDL_CONFIG) --cflags)
cppflags += -DBROGUE_SDL
libs += $(shell $(SDL_CONFIG) --libs) -lSDL2_image
endif
ifeq ($(WEBBROGUE),YES)
sources += $(addprefix src/platform/,web-platform.c)
cppflags += -DBROGUE_WEB
endif
ifeq ($(MAC_APP),YES)
cppflags += -DSDL_PATHS
endif
ifeq ($(DEBUG),YES)
cflags += -g
cppflags += -DWIZARD
else
cflags += -O2
endif
objects := $(sources:.c=.o)
.PHONY: clean
%.o: %.c src/brogue/Rogue.h src/brogue/IncludeGlobals.h
$(CC) $(cppflags) $(CPPFLAGS) $(cflags) $(CFLAGS) -c $< -o $@
bin/brogue: $(objects)
$(CC) $(cflags) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
windows/icon.o: windows/icon.rc
windres $< $@
bin/brogue.exe: $(objects) windows/icon.o
$(CC) $(cflags) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
clean:
$(RM) src/brogue/*.o src/platform/*.o bin/brogue{,.exe}
common-files := bin/assets bin/keymap.txt README.txt CHANGELOG.txt LICENSE.txt seed-catalog.txt
%.txt: %.md
cp $< $@
windows.zip: $(common-files)
zip -rvl $@ $^ bin/brogue.exe bin/*.dll
macos.tar.gz: $(common-files) brogue bin/lib
tar -cavf $@ $^ bin/brogue
linux.tar.gz: $(common-files) brogue
tar -cavf $@ $^ bin/brogue -C linux make-link-for-desktop.sh
# $* is the matched %
icon_%.png: bin/assets/icon.png
convert $< -resize $* $@
macos/Brogue.icns: icon_32.png icon_128.png icon_256.png icon_512.png
png2icns $@ $^
$(RM) $^
Brogue.app: bin/brogue
mkdir -p $@/Contents/{MacOS,Resources}
cp macos/Info.plist $@
cp bin/brogue $@/Contents/MacOS
cp -r macos/Brogue.icns bin/assets $@/Contents/Resources