-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
93 lines (64 loc) · 2.24 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
FLAGS= -g -c -std=gnu99 -Iinclude -Ikazmath
LIBS=-lX11 -lEGL -lGLESv2 -lm
# 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/*.c | sed 's/\(.*\.\)c/\1o/g' | sed 's/kazmath\/kazmath\//o\//g')
all: invaders simple sprites
test:
echo $(KAZ)
lib/libkazmath.a: $(KAZ)
ar -cvq lib/libkazmath.a $(KAZ)
kazmath/%.o: kazmath/%.c
gcc $(FLAGS) $< -o $@
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/ode/src/.libs/libode.a -lstdc++ -lpthread
o/phystest.o: examples/phystest.c
gcc $(FLAGS) -I../ode/include $< -o $@
sprites: $(OBJ) o/sprites.o lib/libkazmath.a
gcc $^ -o sprites $(LIBS)
o/sprites.o: examples/sprites.c
gcc $(FLAGS) $< -o $@
chiptest: $(OBJ) o/chiptest.o lib/libkazmath.a
# gcc $^ -o chiptest $(LIBS) ../Chipmunk-6.1.1/src/libchipmunk.a
# gcc $^ -o chiptest $(LIBS) ../Chipmunk-Physics/src/libchipmunk.a
# gcc $^ -o chiptest $(LIBS) ../Chipmunk-7.0.1/src/libchipmunk.a
gcc $^ -o chiptest $(LIBS) ../Chipmunk-7.0.2/src/libchipmunk.a
o/chiptest.o: examples/chiptest.c
# gcc $(FLAGS) -I../Chipmunk-6.1.1/include/chipmunk/ $< -o $@
# gcc $(FLAGS) -I../Chipmunk-Physics/include/chipmunk/ $< -o $@
# gcc $(FLAGS) -I../Chipmunk-7.0.1/include/chipmunk/ $< -o $@
gcc $(FLAGS) -I../Chipmunk-7.0.2/include/chipmunk/ $< -o $@
# used to create object files from all in src directory
o/%.o: src/%.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 *~
rm -f src/*~
rm -f include/*~
rm -f examples/*~
rm -f resources/shaders/*~
clean-examples:
rm -f invaders
rm -f simple
rm -f phystest
rm -f sprites
rm -f chiptest
clean-all: clean clean-examples
rm -f kazmath/*.o
rm -f lib/libkazmath.a