wip: reader, added key mappings
[physics.git] / src / Makefile
... / ...
CommitLineData
1
2LIBGL := -lGL -lGLU
3LIBSDL := `sdl-config --libs`
4LIBS := ${LIBSDL} ${LIBGL}
5
6OPTFLAGS := -O2
7DBGFLAGS := -ggdb
8PRFFLAGS := ${DBGFLAGS} -pg
9CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS}
10
11VALFLAGS := --leak-check=full
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 += entityCreator.cpp
24SRCS += entityManager.cpp
25SRCS += effectManager.cpp
26SRCS += collisionManager.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/GravityWell.cpp
46SRCS += Effects/Screen.cpp
47
48SRCS += config/config.cpp
49SRCS += config/reader.cpp
50
51SRCS += input/inputManager.cpp
52
53SRCS += graphics/graphics.cpp
54
55OBJSDIR := ../objs/
56OBJS := ${SRCS:.cpp=.o}
57OBJS := $(addprefix ${OBJSDIR},${OBJS})
58
59DEPSDIR := ../deps/
60DEPS := ${SRCS:.cpp=.d}
61DEPS := $(addprefix ${DEPSDIR},${DEPS})
62
63HRDS := ${SRCS:.cpp=.h}
64HRDS := $(filter-out main.h,$HRDS) # remove main.h
65HRDS += debug.h
66
67HRDS += graphics/colors.h
68
69TARS := ${SRCS} ${HRDS} Makefile
70
71
72VERBOSE := 0
73
74ifeq (${VERBOSE},0)
75 # quiet the echo command
76 Q1 := @
77 # quiet the command that is `replaced' by an echo
78 Q2 := @
79else
80 # EAT the echo command as if it was not there
81 Q1 := @true # NOTE: the space between @true and the # is VERY important!!
82 # do not quiet the command output
83 Q2 :=
84endif
85
86.PHONY: all
87all: ${TARGET}
88
89${TARGET}: ${OBJS}
90 ${Q1}echo "${CXX}: $@"
91 ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS}
92
93# rule to make a depend file from a .cpp
94${DEPSDIR}%.d: %.cpp
95 ${Q1}echo "DEP: $@"
96 ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
97
98# rule to make an object file from a .cpp
99${OBJSDIR}%.o: %.cpp
100 ${Q1}echo "${CXX}: $@"
101 ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
102
103
104.PHONY: clean
105clean:
106 ${Q1}echo "CLEAN: OBJS"
107 ${Q2}rm -f ${OBJS}
108 ${Q1}echo "CLEAN: TARGET"
109 ${Q2}rm -f ${TARGET}
110
111.PHONY: distclean
112distclean: clean
113 ${Q1}echo "CLEAN: DEPS"
114 ${Q2}rm -f ${DEPS}
115 ${Q1}echo "CLEAN: tags prof gmon.out"
116 ${Q2}rm -f tags prof gmon.out
117
118.PHONY: gitclean
119gitclean:
120 ${Q1}echo "git-clean: show, use gitcleanf to force"
121 ${Q2}cd ..; git clean -nxd
122
123.PHONY: gitcleanf
124gitcleanf:
125 ${Q1}echo "git-clean: forced"
126 ${Q2}cd ..; git clean -fxd
127
128tags: ${SRCS}
129 ctags $^
130
131.PHONY: tar
132tar: ../physics.tar.bz2
133
134.PHONY: ../physics.tar.bz2
135../physics.tar.bz2:
136 @echo "git-archive: Warning, archives HEAD not current"
137 ${Q1}echo "git-archive: ../physics.tar.bz2"
138 ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2
139
140.PHONY: run
141run: all
142 ${TARGET}
143
144.PHONY: gdb
145gdb: all
146 gdb ${TARGET}
147
148.PHONY: val
149val: all
150 valgrind ${VALFLAGS} ${TARGET}
151
152.PHONY: prof
153prof: all
154 ${TARGET}
155 gprof -b ${TARGET} > prof
156 kprof -f prof
157
158-include ${DEPS}