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