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