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 | |
ad9f1fb6 | 13 | |
046b034c | 14 | SRCS := entityManager.cpp |
054d658f | 15 | SRCS += entityCreator.cpp |
046b034c | 16 | SRCS += game.cpp |
046b034c PG |
17 | SRCS += main.cpp |
18 | SRCS += mathw.cpp | |
19 | SRCS += ticks.cpp | |
20 | SRCS += Vector2.cpp | |
21 | ||
22 | SRCS += Entities/Ball.cpp | |
23 | SRCS += Entities/Entity.cpp | |
24 | SRCS += Entities/Line.cpp | |
25 | SRCS += Entities/Particle.cpp | |
26 | SRCS += Entities/PhysicsEntity.cpp | |
27 | SRCS += Entities/Point.cpp | |
28 | SRCS += Entities/Polygon.cpp | |
29 | SRCS += Entities/WindParticle.cpp | |
30 | ||
31 | SRCS += GameStates/CreatingPolygon.cpp | |
32 | SRCS += GameStates/GameState.cpp | |
33 | SRCS += GameStates/Paused.cpp | |
34 | SRCS += GameStates/Running.cpp | |
35 | ||
f7b3b2eb PG |
36 | SRCS += input/inputManager.cpp |
37 | ||
44b079f8 PG |
38 | SRCS += graphics/graphics.cpp |
39 | ||
40 | OBJS := ${SRCS:.cpp=.o} | |
41 | ||
ad9f1fb6 | 42 | |
44b079f8 | 43 | TARGET := ../run_physics |
466ce08d | 44 | DEPENDS := ${SRCS:.cpp=.d} |
ad9f1fb6 | 45 | |
393654cf PG |
46 | VERBOSE := 0 |
47 | ||
48 | ifeq (${VERBOSE},0) | |
49 | # quiet the echo command | |
50 | Q1 := @ | |
51 | # quiet the command that is `replaced' by an echo | |
52 | Q2 := @ | |
53 | else | |
54 | # EAT the echo command as if it was not there | |
55 | Q1 := @true # NOTE: the space between @true and the # is VERY important!! | |
56 | # do not quiet the command output | |
57 | Q2 := | |
58 | endif | |
ad9f1fb6 | 59 | |
046b034c PG |
60 | .PHONY: all |
61 | all: ${TARGET} | |
ad9f1fb6 | 62 | |
046b034c | 63 | ${TARGET}: ${OBJS} |
393654cf PG |
64 | ${Q1}echo "${CXX}: $@" |
65 | ${Q2}${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS} | |
ad9f1fb6 | 66 | |
466ce08d PG |
67 | # how to make a depend file from a source file |
68 | %.d: %.cpp | |
393654cf PG |
69 | ${Q1}echo "DEP: $@" |
70 | ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@ | |
466ce08d | 71 | #@${CXX} -M ${CXXFLAGS} $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ |
ad9f1fb6 | 72 | |
054d658f | 73 | %.o: %.cpp |
393654cf PG |
74 | ${Q1}echo "${CXX}: $@" |
75 | ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< | |
054d658f | 76 | |
ad9f1fb6 | 77 | |
046b034c | 78 | .PHONY: clean |
ad9f1fb6 | 79 | clean: |
393654cf PG |
80 | ${Q1}echo "CLEAN: OBJS" |
81 | ${Q2}rm -f ${OBJS} | |
82 | ${Q1}echo "CLEAN: TARGET" | |
83 | ${Q2}rm -f ${TARGET} | |
ad9f1fb6 | 84 | |
046b034c | 85 | .PHONY: distclean |
ad9f1fb6 | 86 | distclean: clean |
393654cf PG |
87 | ${Q1}echo "CLEAN: DEPENDS" |
88 | ${Q2}rm -f ${DEPENDS} | |
89 | ${Q1}echo "CLEAN: tags prof gmon.out" | |
90 | ${Q2}rm -f tags prof gmon.out | |
ad9f1fb6 | 91 | |
046b034c PG |
92 | tags: ${SRCS} |
93 | ctags $^ | |
94 | ||
ad9f1fb6 | 95 | tar: clean |
63a52c99 | 96 | cd ..; tar -cjf physics.tar.bz2 src/ |
ad9f1fb6 PG |
97 | |
98 | ||
046b034c PG |
99 | .PHONY: run |
100 | run: all | |
27b74820 | 101 | ${TARGET} |
ad9f1fb6 | 102 | |
63a52c99 PG |
103 | .PHONY: val |
104 | val: all | |
105 | valgrind ${TARGET} | |
106 | ||
107 | .PHONY: prof | |
108 | prof: all | |
109 | ${TARGET} | |
110 | gprof -b ${TARGET} > prof | |
111 | kprof -f prof | |
ad9f1fb6 | 112 | |
466ce08d | 113 | -include ${DEPENDS} |