added screen collisions using an Effect
[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
PG
15SRCS := # simply to keep every line below the same
16SRCS += entityManager.cpp
f206d19d 17SRCS += effectManager.cpp
054d658f 18SRCS += entityCreator.cpp
046b034c 19SRCS += game.cpp
046b034c
PG
20SRCS += main.cpp
21SRCS += mathw.cpp
22SRCS += ticks.cpp
23SRCS += Vector2.cpp
7cbd4505 24SRCS += handleSignal.cpp
046b034c
PG
25
26SRCS += Entities/Ball.cpp
27SRCS += Entities/Entity.cpp
28SRCS += Entities/Line.cpp
29SRCS += Entities/Particle.cpp
30SRCS += Entities/PhysicsEntity.cpp
31SRCS += Entities/Point.cpp
32SRCS += Entities/Polygon.cpp
33SRCS += Entities/WindParticle.cpp
34
35SRCS += GameStates/CreatingPolygon.cpp
36SRCS += GameStates/GameState.cpp
37SRCS += GameStates/Paused.cpp
38SRCS += GameStates/Running.cpp
39
ec70635e
PG
40SRCS += Effects/Effect.cpp
41SRCS += Effects/Gravity.cpp
2c18685d 42SRCS += Effects/Screen.cpp
ec70635e 43
f7b3b2eb
PG
44SRCS += input/inputManager.cpp
45
44b079f8
PG
46SRCS += graphics/graphics.cpp
47
48OBJS := ${SRCS:.cpp=.o}
a4bb9ac2 49DEPENDS := ${SRCS:.cpp=.d}
44b079f8 50
a4bb9ac2
PG
51HRDS := ${SRCS:.cpp=.h}
52HRDS := ${HRDS:main.h=} # remove main.h
53HRDS += debug.h
ec70635e 54
a4bb9ac2
PG
55HRDS += graphics/colors.h
56
57TARS := ${SRCS} ${HRDS} Makefile
ad9f1fb6 58
ad9f1fb6 59
393654cf
PG
60VERBOSE := 0
61
62ifeq (${VERBOSE},0)
63 # quiet the echo command
64 Q1 := @
65 # quiet the command that is `replaced' by an echo
66 Q2 := @
67else
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 :=
72endif
ad9f1fb6 73
046b034c
PG
74.PHONY: all
75all: ${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 93clean:
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 100distclean: 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
106tags: ${SRCS}
107 ctags $^
108
a4bb9ac2 109tar:
7dd353d9 110 ${Q1}echo "tar: physics.tar.bz2"
a4bb9ac2
PG
111 ${Q2}rm -f physics.tar # prevents appending
112 ${Q2}for f in ${TARS}; do\
113 tar -C ../.. -rf physics.tar "physics/src/$$f"; done
114 ${Q2}bzip2 physics.tar
ad9f1fb6 115
a4bb9ac2
PG
116git-tar:
117 ${Q1}echo "git-archive: ../physics.tar.bz2"
118 ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2
ad9f1fb6 119
046b034c
PG
120.PHONY: run
121run: all
27b74820 122 ${TARGET}
ad9f1fb6 123
6aad402a
PG
124.PHONY: gdb
125gdb: all
126 gdb ${TARGET}
127
63a52c99
PG
128.PHONY: val
129val: all
f72f4a59 130 valgrind --leak-check=full ${TARGET}
63a52c99
PG
131
132.PHONY: prof
133prof: all
134 ${TARGET}
135 gprof -b ${TARGET} > prof
136 kprof -f prof
ad9f1fb6 137
466ce08d 138-include ${DEPENDS}