Commit | Line | Data |
---|---|---|
ad9f1fb6 | 1 | |
44b079f8 PG |
2 | LIBGL := -lGL -lGLU |
3 | LIBSDL := `sdl-config --libs` | |
4 | LIBS := ${LIBSDL} ${LIBGL} | |
5 | ||
6 | OPTFLAGS := -O2 | |
7 | DBGFLAGS := -ggdb | |
8 | PRFFLAGS := ${DBGFLAGS} -pg | |
44b079f8 | 9 | CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS} |
ad9f1fb6 | 10 | |
88e62c4f PG |
11 | VALFLAGS := --leak-check=full |
12 | ||
a4bb9ac2 | 13 | TARGET := ../run_physics |
ad9f1fb6 | 14 | |
a4bb9ac2 | 15 | SRCS := # simply to keep every line below the same |
046b034c | 16 | SRCS += game.cpp |
046b034c PG |
17 | SRCS += main.cpp |
18 | SRCS += mathw.cpp | |
19 | SRCS += ticks.cpp | |
20 | SRCS += Vector2.cpp | |
7cbd4505 | 21 | SRCS += handleSignal.cpp |
046b034c | 22 | |
0ac1dc80 | 23 | SRCS += entityCreator.cpp |
54fe85c5 PG |
24 | SRCS += entityManager.cpp |
25 | SRCS += effectManager.cpp | |
0ac1dc80 | 26 | SRCS += collisionManager.cpp |
54fe85c5 PG |
27 | SRCS += CollisionInfo.cpp |
28 | ||
046b034c PG |
29 | SRCS += Entities/Ball.cpp |
30 | SRCS += Entities/Entity.cpp | |
31 | SRCS += Entities/Line.cpp | |
32 | SRCS += Entities/Particle.cpp | |
33 | SRCS += Entities/PhysicsEntity.cpp | |
34 | SRCS += Entities/Point.cpp | |
35 | SRCS += Entities/Polygon.cpp | |
36 | SRCS += Entities/WindParticle.cpp | |
37 | ||
38 | SRCS += GameStates/CreatingPolygon.cpp | |
39 | SRCS += GameStates/GameState.cpp | |
40 | SRCS += GameStates/Paused.cpp | |
41 | SRCS += GameStates/Running.cpp | |
42 | ||
ec70635e PG |
43 | SRCS += Effects/Effect.cpp |
44 | SRCS += Effects/Gravity.cpp | |
46e842c7 | 45 | SRCS += Effects/GravityWell.cpp |
2c18685d | 46 | SRCS += Effects/Screen.cpp |
ec70635e | 47 | |
b1d92c2f | 48 | SRCS += config/config.cpp |
6a40b627 | 49 | SRCS += config/reader.cpp |
8f8b6693 | 50 | |
f7b3b2eb PG |
51 | SRCS += input/inputManager.cpp |
52 | ||
44b079f8 PG |
53 | SRCS += graphics/graphics.cpp |
54 | ||
f4b779e4 | 55 | OBJSDIR := ../objs/ |
44b079f8 | 56 | OBJS := ${SRCS:.cpp=.o} |
f4b779e4 PG |
57 | OBJS := $(addprefix ${OBJSDIR},${OBJS}) |
58 | ||
59 | DEPSDIR := ../deps/ | |
60 | DEPS := ${SRCS:.cpp=.d} | |
61 | DEPS := $(addprefix ${DEPSDIR},${DEPS}) | |
44b079f8 | 62 | |
a4bb9ac2 | 63 | HRDS := ${SRCS:.cpp=.h} |
5d5a6f3f | 64 | HRDS := $(filter-out main.h,$HRDS) # remove main.h |
a4bb9ac2 | 65 | HRDS += debug.h |
ec70635e | 66 | |
a4bb9ac2 PG |
67 | HRDS += graphics/colors.h |
68 | ||
69 | TARS := ${SRCS} ${HRDS} Makefile | |
ad9f1fb6 | 70 | |
ad9f1fb6 | 71 | |
393654cf PG |
72 | VERBOSE := 0 |
73 | ||
74 | ifeq (${VERBOSE},0) | |
75 | # quiet the echo command | |
76 | Q1 := @ | |
77 | # quiet the command that is `replaced' by an echo | |
78 | Q2 := @ | |
79 | else | |
80 | # EAT the echo command as if it was not there | |
81 | Q1 := @true # NOTE: the space between @true and the # is VERY important!! | |
82 | # do not quiet the command output | |
83 | Q2 := | |
84 | endif | |
ad9f1fb6 | 85 | |
046b034c PG |
86 | .PHONY: all |
87 | all: ${TARGET} | |
ad9f1fb6 | 88 | |
046b034c | 89 | ${TARGET}: ${OBJS} |
393654cf | 90 | ${Q1}echo "${CXX}: $@" |
eb0c55e7 | 91 | ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS} |
ad9f1fb6 | 92 | |
a4bb9ac2 | 93 | # rule to make a depend file from a .cpp |
f4b779e4 | 94 | ${DEPSDIR}%.d: %.cpp |
393654cf PG |
95 | ${Q1}echo "DEP: $@" |
96 | ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@ | |
ad9f1fb6 | 97 | |
a4bb9ac2 | 98 | # rule to make an object file from a .cpp |
f4b779e4 | 99 | ${OBJSDIR}%.o: %.cpp |
393654cf PG |
100 | ${Q1}echo "${CXX}: $@" |
101 | ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< | |
054d658f | 102 | |
ad9f1fb6 | 103 | |
046b034c | 104 | .PHONY: clean |
ad9f1fb6 | 105 | clean: |
393654cf PG |
106 | ${Q1}echo "CLEAN: OBJS" |
107 | ${Q2}rm -f ${OBJS} | |
108 | ${Q1}echo "CLEAN: TARGET" | |
109 | ${Q2}rm -f ${TARGET} | |
ad9f1fb6 | 110 | |
046b034c | 111 | .PHONY: distclean |
ad9f1fb6 | 112 | distclean: clean |
f4b779e4 PG |
113 | ${Q1}echo "CLEAN: DEPS" |
114 | ${Q2}rm -f ${DEPS} | |
393654cf PG |
115 | ${Q1}echo "CLEAN: tags prof gmon.out" |
116 | ${Q2}rm -f tags prof gmon.out | |
ad9f1fb6 | 117 | |
d893cce2 PG |
118 | .PHONY: gitclean |
119 | gitclean: | |
120 | ${Q1}echo "git-clean: show, use gitcleanf to force" | |
121 | ${Q2}cd ..; git clean -nxd | |
122 | ||
123 | .PHONY: gitcleanf | |
124 | gitcleanf: | |
125 | ${Q1}echo "git-clean: forced" | |
126 | ${Q2}cd ..; git clean -fxd | |
127 | ||
046b034c PG |
128 | tags: ${SRCS} |
129 | ctags $^ | |
130 | ||
7adc59fe | 131 | .PHONY: tar |
8381f595 PG |
132 | tar: ../physics.tar.bz2 |
133 | ||
134 | .PHONY: ../physics.tar.bz2 | |
135 | ../physics.tar.bz2: | |
136 | @echo "git-archive: Warning, archives HEAD not current" | |
a4bb9ac2 PG |
137 | ${Q1}echo "git-archive: ../physics.tar.bz2" |
138 | ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2 | |
ad9f1fb6 | 139 | |
046b034c PG |
140 | .PHONY: run |
141 | run: all | |
27b74820 | 142 | ${TARGET} |
ad9f1fb6 | 143 | |
6aad402a PG |
144 | .PHONY: gdb |
145 | gdb: all | |
146 | gdb ${TARGET} | |
147 | ||
63a52c99 PG |
148 | .PHONY: val |
149 | val: all | |
e861d993 | 150 | valgrind ${VALFLAGS} ${TARGET} |
63a52c99 PG |
151 | |
152 | .PHONY: prof | |
153 | prof: all | |
154 | ${TARGET} | |
155 | gprof -b ${TARGET} > prof | |
156 | kprof -f prof | |
ad9f1fb6 | 157 | |
f4b779e4 | 158 | -include ${DEPS} |