added ball to ball collisions
[physics.git] / src / Makefile
CommitLineData
ad9f1fb6 1
44b079f8
PG
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}
ad9f1fb6 12
a4bb9ac2 13TARGET := ../run_physics
ad9f1fb6 14
a4bb9ac2 15SRCS := # simply to keep every line below the same
046b034c 16SRCS += game.cpp
046b034c
PG
17SRCS += main.cpp
18SRCS += mathw.cpp
19SRCS += ticks.cpp
20SRCS += Vector2.cpp
7cbd4505 21SRCS += handleSignal.cpp
046b034c 22
54fe85c5
PG
23SRCS += entityManager.cpp
24SRCS += effectManager.cpp
25SRCS += entityCreator.cpp
26SRCS += collisionHandler.cpp
27SRCS += CollisionInfo.cpp
28
046b034c
PG
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
ec70635e
PG
43SRCS += Effects/Effect.cpp
44SRCS += Effects/Gravity.cpp
2c18685d 45SRCS += Effects/Screen.cpp
ec70635e 46
f7b3b2eb
PG
47SRCS += input/inputManager.cpp
48
44b079f8
PG
49SRCS += graphics/graphics.cpp
50
51OBJS := ${SRCS:.cpp=.o}
a4bb9ac2 52DEPENDS := ${SRCS:.cpp=.d}
44b079f8 53
a4bb9ac2
PG
54HRDS := ${SRCS:.cpp=.h}
55HRDS := ${HRDS:main.h=} # remove main.h
56HRDS += debug.h
ec70635e 57
a4bb9ac2
PG
58HRDS += graphics/colors.h
59
60TARS := ${SRCS} ${HRDS} Makefile
ad9f1fb6 61
ad9f1fb6 62
393654cf
PG
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
ad9f1fb6 76
046b034c
PG
77.PHONY: all
78all: ${TARGET}
ad9f1fb6 79
046b034c 80${TARGET}: ${OBJS}
393654cf
PG
81 ${Q1}echo "${CXX}: $@"
82 ${Q2}${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
ad9f1fb6 83
a4bb9ac2 84# rule to make a depend file from a .cpp
466ce08d 85%.d: %.cpp
393654cf
PG
86 ${Q1}echo "DEP: $@"
87 ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
ad9f1fb6 88
a4bb9ac2 89# rule to make an object file from a .cpp
054d658f 90%.o: %.cpp
393654cf
PG
91 ${Q1}echo "${CXX}: $@"
92 ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
054d658f 93
ad9f1fb6 94
046b034c 95.PHONY: clean
ad9f1fb6 96clean:
393654cf
PG
97 ${Q1}echo "CLEAN: OBJS"
98 ${Q2}rm -f ${OBJS}
99 ${Q1}echo "CLEAN: TARGET"
100 ${Q2}rm -f ${TARGET}
ad9f1fb6 101
046b034c 102.PHONY: distclean
ad9f1fb6 103distclean: clean
393654cf
PG
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
ad9f1fb6 108
046b034c
PG
109tags: ${SRCS}
110 ctags $^
111
7adc59fe 112.PHONY: tar
a4bb9ac2 113tar:
7dd353d9 114 ${Q1}echo "tar: physics.tar.bz2"
a4bb9ac2
PG
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
ad9f1fb6 119
7adc59fe 120.PHONY: git-tar
a4bb9ac2
PG
121git-tar:
122 ${Q1}echo "git-archive: ../physics.tar.bz2"
123 ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2
ad9f1fb6 124
046b034c
PG
125.PHONY: run
126run: all
27b74820 127 ${TARGET}
ad9f1fb6 128
6aad402a
PG
129.PHONY: gdb
130gdb: all
131 gdb ${TARGET}
132
63a52c99
PG
133.PHONY: val
134val: all
f72f4a59 135 valgrind --leak-check=full ${TARGET}
63a52c99
PG
136
137.PHONY: prof
138prof: all
139 ${TARGET}
140 gprof -b ${TARGET} > prof
141 kprof -f prof
ad9f1fb6 142
466ce08d 143-include ${DEPENDS}