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 PG |
14 | SRCS := entityManager.cpp |
15 | SRCS += game.cpp | |
046b034c PG |
16 | SRCS += main.cpp |
17 | SRCS += mathw.cpp | |
18 | SRCS += ticks.cpp | |
19 | SRCS += Vector2.cpp | |
20 | ||
21 | SRCS += Entities/Ball.cpp | |
22 | SRCS += Entities/Entity.cpp | |
23 | SRCS += Entities/Line.cpp | |
24 | SRCS += Entities/Particle.cpp | |
25 | SRCS += Entities/PhysicsEntity.cpp | |
26 | SRCS += Entities/Point.cpp | |
27 | SRCS += Entities/Polygon.cpp | |
28 | SRCS += Entities/WindParticle.cpp | |
29 | ||
30 | SRCS += GameStates/CreatingPolygon.cpp | |
31 | SRCS += GameStates/GameState.cpp | |
32 | SRCS += GameStates/Paused.cpp | |
33 | SRCS += GameStates/Running.cpp | |
34 | ||
f7b3b2eb PG |
35 | SRCS += input/inputManager.cpp |
36 | ||
44b079f8 PG |
37 | SRCS += graphics/graphics.cpp |
38 | ||
39 | OBJS := ${SRCS:.cpp=.o} | |
40 | ||
ad9f1fb6 | 41 | |
44b079f8 | 42 | TARGET := ../run_physics |
466ce08d | 43 | DEPENDS := ${SRCS:.cpp=.d} |
ad9f1fb6 | 44 | |
ad9f1fb6 | 45 | |
046b034c PG |
46 | .PHONY: all |
47 | all: ${TARGET} | |
ad9f1fb6 | 48 | |
046b034c PG |
49 | ${TARGET}: ${OBJS} |
50 | ${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS} | |
466ce08d | 51 | @echo "" |
ad9f1fb6 | 52 | |
046b034c PG |
53 | .PHONY: depend |
54 | depend: ${SRCS} | |
466ce08d PG |
55 | ${CXX} -MM $^ > ${DEPENDS} |
56 | ||
57 | # how to make a depend file from a source file | |
58 | %.d: %.cpp | |
59 | @echo "DEP: $@" | |
60 | @${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@ | |
61 | ||
62 | #@${CXX} -M ${CXXFLAGS} $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ | |
ad9f1fb6 | 63 | |
ad9f1fb6 | 64 | |
046b034c | 65 | .PHONY: clean |
ad9f1fb6 | 66 | clean: |
63a52c99 | 67 | rm -f ${OBJS} ${TARGET} *~ prof gmon.out |
ad9f1fb6 | 68 | |
046b034c | 69 | .PHONY: distclean |
ad9f1fb6 | 70 | distclean: clean |
466ce08d | 71 | rm -f tags ${DEPENDS} |
ad9f1fb6 | 72 | |
046b034c PG |
73 | tags: ${SRCS} |
74 | ctags $^ | |
75 | ||
ad9f1fb6 | 76 | tar: clean |
63a52c99 | 77 | cd ..; tar -cjf physics.tar.bz2 src/ |
ad9f1fb6 PG |
78 | |
79 | ||
046b034c PG |
80 | .PHONY: run |
81 | run: all | |
27b74820 | 82 | ${TARGET} |
ad9f1fb6 | 83 | |
63a52c99 PG |
84 | .PHONY: val |
85 | val: all | |
86 | valgrind ${TARGET} | |
87 | ||
88 | .PHONY: prof | |
89 | prof: all | |
90 | ${TARGET} | |
91 | gprof -b ${TARGET} > prof | |
92 | kprof -f prof | |
ad9f1fb6 | 93 | |
466ce08d | 94 | -include ${DEPENDS} |