added cgmath, libanim, and libpsys
[andemo] / Makefile
1 src = $(wildcard src/*.c) $(wildcard src/pc/*.c) libs/glew/glew.c
2 obj = $(src:.c=.o)
3 dep = $(src:.c=.d)
4 bin = demo
5
6 warn = -pedantic -Wall
7 dbg = -g
8 #opt = -O3 -ffast-math -fno-strict-aliasing
9 def = -DMINIGLUT_USE_LIBC -DGLEW_STATIC
10 incdir = -Isrc -Ilibs -Ilibs/imago/src -Ilibs/glew
11 libdir = -Llibs/unix
12
13 CFLAGS = $(warn) $(dbg) $(opt) $(def) $(incdir) -fcommon -MMD
14 LDFLAGS = $(libdir) $(libsys) $(libgl) -limago -lpsys -lanim $(libc)
15
16 sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
17 ifeq ($(sys), mingw)
18         obj = $(src:.c=.w32.o)
19         bin = demo.exe
20         libgl = -lopengl32
21         libsys = -lmingw32 -lgdi32 -lwinmm -mconsole
22         libdir = -Llibs/w32
23         libc = -lm
24 else
25         libgl = -lGL -lX11 -lXext
26         libc = -lm -ldl
27 endif
28
29 $(bin): $(obj) Makefile
30         $(CC) -o $@ $(obj) $(LDFLAGS)
31
32 -include $(dep)
33
34 %.w32.o: %.c
35         $(CC) -o $@ $(CFLAGS) -c $<
36
37 .PHONY: clean
38 clean:
39         rm -f $(obj) $(bin)
40
41 .PHONY: cleandep
42 cleandep:
43         rm -f $(dep)
44
45 .PHONY: libs
46 libs:
47         $(MAKE) -C libs
48
49 .PHONY: clean-libs
50 clean-libs:
51         $(MAKE) -C libs clean
52
53 .PHONY: android
54 android:
55         $(MAKE) -f Makefile.android
56
57 .PHONY: android-clean
58 android-clean:
59         $(MAKE) -f Makefile.android clean
60
61 .PHONY: android-libs
62 android-libs:
63         $(MAKE) -f Makefile.android libs
64
65 .PHONY: run
66 run:
67         $(MAKE) -f Makefile.android install run
68
69 .PHONY: stop
70 stop:
71         $(MAKE) -f Makefile.android stop
72
73 .PHONY: cross
74 cross:
75         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
76
77 .PHONY: cross-libs
78 cross-libs:
79         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs
80
81 .PHONY: cross-clean
82 cross-clean:
83         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean
84
85 .PHONY: cross-clean-libs
86 cross-clean-libs:
87         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs clean