-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·114 lines (97 loc) · 2.58 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
SDL_FLAGS = `sdl-config --cflags` `sdl-config --libs`
LIBTCODDIR=src/libtcod-1.5.2
CFLAGS=-Isrc/brogue -Isrc/platform -Wall -Wno-parentheses ${DEFINES}
RELEASENAME=brogue-1.7.4
LASTTARGET := $(shell ./brogue --target)
CC ?= gcc
ifeq (${LASTTARGET},both)
all : both
else ifeq (${LASTTARGET},curses)
all : curses
else ifeq (${LASTTARGET},tcod)
all : tcod
else
all : both
endif
%.o : %.c Makefile src/brogue/Rogue.h src/brogue/IncludeGlobals.h
$(CC) $(CFLAGS) -g -o $@ -c $<
BROGUEFILES=src/brogue/Architect.o \
src/brogue/Combat.o \
src/brogue/Dijkstra.o \
src/brogue/Globals.o \
src/brogue/IO.o \
src/brogue/Items.o \
src/brogue/Light.o \
src/brogue/Monsters.o \
src/brogue/Buttons.o \
src/brogue/Movement.o \
src/brogue/Recordings.o \
src/brogue/RogueMain.o \
src/brogue/Random.o \
src/brogue/MainMenu.o \
src/brogue/Grid.o \
src/brogue/Time.o \
src/brogue/PowerTables.o \
src/brogue/Sqrt.o \
src/platform/main.o \
src/platform/platformdependent.o \
src/platform/curses-platform.o \
src/platform/tcod-platform.o \
src/platform/term.o
TCOD_DEF = -DBROGUE_TCOD -I$(LIBTCODDIR)/include
TCOD_DEP = ${LIBTCODDIR}
TCOD_LIB = -L. -L${LIBTCODDIR} ${SDL_FLAGS} -ltcod -Wl,-rpath,.
CURSES_DEF = -DBROGUE_CURSES
CURSES_LIB = -lncurses -lm
tcod : DEPENDENCIES += ${TCOD_DEP}
tcod : DEFINES += ${TCOD_DEF}
tcod : LIBRARIES += ${TCOD_LIB}
curses : DEFINES = ${CURSES_DEF}
curses : LIBRARIES = ${CURSES_LIB}
both : DEPENDENCIES += ${TCOD_DEP}
both : DEFINES += ${TCOD_DEF} ${CURSES_DEF}
both : LIBRARIES += ${TCOD_LIB} ${CURSES_LIB}
ifeq (${LASTTARGET},both)
both : bin/brogue
tcod : clean bin/brogue
curses : clean bin/brogue
else ifeq (${LASTTARGET},curses)
curses : bin/brogue
tcod : clean bin/brogue
both : clean bin/brogue
else ifeq (${LASTTARGET},tcod)
tcod : bin/brogue
curses : clean bin/brogue
both : clean bin/brogue
else
both : bin/brogue
curses : bin/brogue
tcod : bin/brogue
endif
.PHONY : clean both curses tcod tar
bin/brogue : ${DEPENDENCIES} ${BROGUEFILES}
$(CC) -O2 -march=i586 -o bin/brogue ${BROGUEFILES} ${LIBRARIES} -Wl,-rpath,.
clean :
rm -f src/brogue/*.o src/platform/*.o bin/brogue
${LIBTCODDIR} :
src/get-libtcod.sh
tar : both
rm -f ${RELEASENAME}.tar.gz
tar --transform 's,^,${RELEASENAME}/,' -czf ${RELEASENAME}.tar.gz \
Makefile \
brogue \
$(wildcard *.sh) \
$(wildcard *.rtf) \
readme \
$(wildcard *.txt) \
bin/brogue \
bin/keymap \
bin/icon.bmp \
bin/brogue-icon.png \
$(wildcard bin/fonts/*.png) \
$(wildcard bin/*.so) \
$(wildcard src/*.sh) \
$(wildcard src/brogue/*.c) \
$(wildcard src/brogue/*.h) \
$(wildcard src/platform/*.c) \
$(wildcard src/platform/*.h)