-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (71 loc) · 1.64 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
# build options --------
vrbuild = true
# ----------------------
src = $(wildcard src/*.c)
obj = $(src:.c=.o)
dep = $(src:.c=.d)
bin = game
#opt = -O3 -ffast-math -fno-strict-aliasing
dbg = -g
warn = -pedantic -Wall
def = -DMINIGLUT_USE_LIBC -DGLDEBUG
inc = -Ilibs -Ilibs/treestore -Ilibs/drawtext -Ilibs/imago/src -Ilibs/goatvr
CFLAGS = $(warn) $(opt) $(dbg) $(def) $(inc) -fcommon -MMD
LDFLAGS = $(libdir) $(libsys) $(libgl) $(libal) $(libvr) -ldrawtext -limago -ltreestore \
-lanim -lpsys $(libc)
sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
ifeq ($(sys), mingw)
obj = $(src:.c=.w32.o)
bin = game.exe
libdir = -Llibs/w32
libgl = -lopengl32
libal = -lopenal
libsys = -lmingw32 -lgdi32 -lwinmm -mconsole
libc = -lm
ifeq ($(vrbuild), true)
libvr = -lgoatvr -lgmath -lovr -lopenvr_api
endif
else
libdir = -Llibs
libgl = -lGL -lX11 -lXext
libal = -lopenal
libc = -lm -ldl
ifeq ($(vrbuild), true)
libvr = -lgoatvr -lgmath -lopenvr_api
endif
endif
ifeq ($(vrbuild), true)
def += -DBUILD_VR
LD = $(CXX)
else
LD = $(CC)
endif
$(bin): $(obj)
$(LD) -o $@ $(obj) $(LDFLAGS)
-include $(dep)
%.w32.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
.PHONY: clean
clean:
rm -f $(obj) $(bin)
.PHONY: cleandep
cleandep:
rm -f $(dep)
.PHONY: libs
libs:
$(MAKE) -C libs
.PHONY: clean-libs
clean-libs:
$(MAKE) -C libs clean
.PHONY: cross
cross:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
.PHONY: cross-libs
cross-libs:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs
.PHONY: cross-clean
cross-clean:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean
.PHONY: cross-clean-libs
cross-clean-libs:
$(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs clean