wall noise and arbitrary render resolution option
[raydungeon] / Makefile
1 src = $(wildcard src/*.c) libs/glew/glew.c
2 obj = $(src:.c=.o)
3 dep = $(src:.c=.d)
4 bin = game
5
6 warn = -pedantic -Wall
7 dbg = -g
8 def = -DMINIGLUT_USE_LIBC -DGLEW_STATIC
9
10 inc = -Ilibs -Ilibs/assfile -Ilibs/treestor/include -Ilibs/glew
11 libs = -lassfile -ldrawtext -lgoat3d -limago -ltreestor
12
13 CFLAGS = $(warn) $(opt) $(dbg) $(inc) $(def) -MMD
14 LDFLAGS = $(libdir) $(syslib) $(libgl) $(libs) -lm
15
16 sys := $(shell uname -s | sed 's/MINGW.*/mingw/')
17 ifeq ($(sys), mingw)
18         syslib = -mwindows
19         libgl = -lopengl32 -lgdi32 -lwinmm
20
21         obj = $(src:.c=.w32.o)
22         dep = $(src:.c=.w32.d)
23         bin = game.exe
24
25         libdir = -Llibs/w32
26 else
27         libgl = -lGL -lX11
28
29         libdir = -Llibs/unix
30 endif
31
32 $(bin): $(obj) libs
33         $(CC) -o $@ $(obj) $(LDFLAGS)
34
35 -include $(dep)
36
37 %.w32.o: %.c
38         $(CC) -c $< $(CFLAGS) -o $@
39
40 .PHONY: libs
41 libs:
42         $(MAKE) -C libs
43
44 .PHONY: clean-libs
45 clean-libs:
46         $(MAKE) -C libs clean
47
48 .PHONY: clean
49 clean:
50         rm -f $(obj) $(bin)
51
52 .PHONY: cross
53 cross:
54         $(MAKE) CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar sys=mingw
55
56 .PHONY: clean-cross
57 clean-cross:
58         $(MAKE) sys=mingw clean