android builds now include both 64 and 32bit in the APK
[andemo] / Makefile
1 src = $(wildcard src/*.c) $(wildcard src/scr/*.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/treestore -Ilibs/glew
11 libs_path = libs/unix
12 libdir = -L$(libs_path)
13
14 libs = $(libs_path)/libimago.a $(libs_path)/libtreestore.a $(libs_path)/libanim.a \
15            $(libs_path)/libpsys.a
16
17 CFLAGS = $(warn) $(dbg) $(opt) $(def) $(incdir) -fcommon -MMD
18 LDFLAGS = $(libdir) $(libsys) $(libgl) -limago -lpsys -lanim -ltreestore $(libc)
19
20 sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
21 ifeq ($(sys), mingw)
22         obj = $(src:.c=.w32.o)
23         bin = demo.exe
24         libgl = -lopengl32
25         libsys = -lmingw32 -lgdi32 -lwinmm -mconsole
26         libs_path = libs/w32
27         libc = -lm
28 else
29         libgl = -lGL -lX11 -lXext
30         libc = -lm -ldl
31 endif
32
33 $(bin): $(obj) Makefile $(libs)
34         $(CC) -o $@ $(obj) $(LDFLAGS)
35
36 -include $(dep)
37
38 %.w32.o: %.c
39         $(CC) -o $@ $(CFLAGS) -c $<
40
41 .PHONY: clean
42 clean:
43         rm -f $(obj) $(bin)
44
45 .PHONY: cleandep
46 cleandep:
47         rm -f $(dep)
48
49 .PHONY: libs
50 libs:
51         $(MAKE) -C libs
52
53 .PHONY: clean-libs
54 clean-libs:
55         $(MAKE) -C libs clean
56
57 .PHONY: android
58 android:
59         $(MAKE) -f Makefile.android
60
61 .PHONY: android-clean
62 android-clean:
63         $(MAKE) -f Makefile.android clean
64
65 .PHONY: android-libs
66 android-libs:
67         $(MAKE) -f Makefile.android libs
68
69 .PHONY: install
70 install:
71         $(MAKE) -f Makefile.android install
72
73 .PHONY: run
74 run:
75         $(MAKE) -f Makefile.android install run
76
77 .PHONY: stop
78 stop:
79         $(MAKE) -f Makefile.android stop
80
81 .PHONY: cross
82 cross:
83         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
84
85 .PHONY: cross-libs
86 cross-libs:
87         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs
88
89 .PHONY: cross-clean
90 cross-clean:
91         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean
92
93 .PHONY: cross-clean-libs
94 cross-clean-libs:
95         $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw -C libs clean