-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (55 loc) · 1.5 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
ccsrc = $(wildcard src/*.cc) \
$(wildcard libs/gmath/*.cc) \
csrc = $(wildcard src/*.c) \
$(wildcard libs/imago/*.c) \
$(wildcard libs/zlib/*.c) \
$(wildcard libs/libpng/*.c) \
$(wildcard libs/libjpeg/*.c) \
$(wildcard libs/drawtext/*.c)
# $(wildcard libs/ogg/*.c) \
# $(wildcard libs/vorbis/*.c)
obj = $(ccsrc:.cc=.o) $(csrc:.c=.o)
dep = $(obj:.o=.d)
bin = game
warn = -pedantic -Wall -Wno-format-overflow
dbg = -g
opt = -O3 -ffast-math
inc = -Ilibs -Ilibs/imago -Ilibs/libpng -Ilibs/zlib -Ilibs/libjpeg \
-Ilibs/ogg -Ilibs/vorbis -Ilibs/drawtext
def = -DNO_FREETYPE -DDEV_BUILD
CFLAGS = $(warn) -MMD $(dbg) $(opt) $(inc) $(def)
CXXFLAGS = $(warn) -MMD $(dbg) $(opt) $(inc) $(def)
LDFLAGS = $(libsys) $(libgl) -lpthread
sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
ifeq ($(sys), mingw)
obj = $(ccsrc:.cc=.w32.o) $(csrc:.c=.w32.o)
dep = $(obj:.o=.d)
bin = game.exe
libgl = -lopengl32 -lglu32 -lglew32 -lfreeglut
libsys = -lmingw32 -mconsole
else
libgl = -lGL -lGLU -lglut -lGLEW
libsys = -ldl -lm
endif
$(bin): $(obj)
$(CXX) -o $@ $(obj) $(LDFLAGS)
-include $(dep)
%.w32.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
%.w32.o: %.cc
$(CXX) -o $@ $(CFLAGS) -c $<
.PHONY: clean
clean:
rm -f $(obj) $(bin)
.PHONY: cleandep
cleandep:
rm -f $(dep)
.PHONY: cleanobj
cleanobj:
rm -f $(obj)
.PHONY: cross
cross:
$(MAKE) CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ sys=mingw
.PHONY: cross-clean
cross-clean:
$(MAKE) CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ sys=mingw clean