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