forked from chriscamacho/gles2framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
109 lines (77 loc) · 2.82 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# only ONE of these three
# xorg - for running in normal xwindows when you can't get to your PI :-o
# rpi - uses xwindows to provide event handling
# rpi_noX - get keyboard events from raw input, xwindows not needed
PLATFORM=xorg
PLATFORM=rpi
#PLATFORM=rpi_noX
####
ifeq ($(PLATFORM),xorg)
FLAGS= -g -D__FOR_XORG__ -c -std=gnu99 `pkg-config libpng --cflags` -Iinclude -Ikazmath/kazmath
LIBS=-lX11 -lEGL -lGLESv2 `pkg-config libpng --libs` -lm
endif
ifeq ($(PLATFORM),rpi)
FLAGS=-D__FOR_RPi__ -c -std=gnu99 `pkg-config libpng --cflags` -Iinclude -Ikazmath/kazmath
FLAGS+= -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads/
LIBS=-lX11 -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib `pkg-config libpng --libs`
endif
ifeq ($(PLATFORM),rpi_noX)
FLAGS=-D__FOR_RPi_noX__ -c -std=gnu99 `pkg-config libpng --cflags` -Iinclude -Ikazmath/kazmath
FLAGS+= -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads/
LIBS=-lX11 -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib `pkg-config libpng --libs`
endif
# ok.... find all src/*.c replace all .c with .o then replace src\ with o\ - and breath
# this is the framework itself without samples
OBJ=$(shell find src/*.c | sed 's/\(.*\.\)c/\1o/g' | sed 's/src\//o\//g')
#kazmath
KAZ=$(shell find kazmath/kazmath/*.c | sed 's/\(.*\.\)c/\1o/g' | sed 's/kazmath\/kazmath\//o\//g')
all: invaders simple sprites
invaders: $(OBJ) o/invaders.o lib/libkazmath.a
gcc $^ -o invaders $(LIBS)
o/invaders.o: examples/invaders.c
gcc $(FLAGS) $< -o $@
simple: $(OBJ) o/simple.o lib/libkazmath.a
gcc $^ -o simple $(LIBS)
o/simple.o: examples/simple.c
gcc $(FLAGS) $< -o $@
phystest: $(OBJ) o/phystest.o lib/libkazmath.a
gcc $^ -o phystest $(LIBS) ../ode-0.12/ode/src/.libs/libode.a -lstdc++
o/phystest.o: examples/phystest.c
gcc $(FLAGS) -DdSINGLE -I../ode-0.12/include/ $< -o $@
sprites: $(OBJ) o/sprites.o lib/libkazmath.a
gcc $^ -o sprites $(LIBS)
o/sprites.o: examples/sprites.c
gcc $(FLAGS) $< -o $@
test: $(OBJ) o/test.o lib/libkazmath.a
gcc $^ -o test $(LIBS)
o/test.o: examples/test.c
gcc $(FLAGS) $< -o $@
chiptest: $(OBJ) o/chiptest.o lib/libkazmath.a
gcc $^ -o chiptest $(LIBS) ../Chipmunk-6.1.1/src/libchipmunk.a
o/chiptest.o: examples/chiptest.c
gcc $(FLAGS) -I../Chipmunk-6.1.1/include/chipmunk/ $< -o $@
# used to create object files from all in src directory
o/%.o: src/%.c
gcc $(FLAGS) $< -o $@
lib/libkazmath.a: $(KAZ)
ar -cvq lib/libkazmath.a $(KAZ)
o/%.o: kazmath/kazmath/%.c
gcc $(FLAGS) $< -o $@
# makes the code look nice!
indent:
astyle src/*.c include/*.h example/*.c
# deletes all intermediate object files and all compiled
# executables and automatic source backup files
clean:
rm -f o/*.o
rm -f lib/libkazmath.a
rm -f *~
rm -f src/*~
rm -f include/*~
rm -f examples/*~
rm -f resources/shaders/*~
rm -f invaders
rm -f simple
rm -f phystest
rm -f sprites
rm -f chiptest