created a gravity well
[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
e861d993 9VALFLAGS := --leak-check=full
44b079f8
PG
10
11#CXX := g++
12CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS}
ad9f1fb6 13
a4bb9ac2 14TARGET := ../run_physics
ad9f1fb6 15
a4bb9ac2 16SRCS := # simply to keep every line below the same
046b034c 17SRCS += game.cpp
046b034c
PG
18SRCS += main.cpp
19SRCS += mathw.cpp
20SRCS += ticks.cpp
21SRCS += Vector2.cpp
7cbd4505 22SRCS += handleSignal.cpp
046b034c 23
54fe85c5
PG
24SRCS += entityManager.cpp
25SRCS += effectManager.cpp
26SRCS += entityCreator.cpp
27SRCS += collisionHandler.cpp
28SRCS += CollisionInfo.cpp
29
046b034c
PG
30SRCS += Entities/Ball.cpp
31SRCS += Entities/Entity.cpp
32SRCS += Entities/Line.cpp
33SRCS += Entities/Particle.cpp
34SRCS += Entities/PhysicsEntity.cpp
35SRCS += Entities/Point.cpp
36SRCS += Entities/Polygon.cpp
37SRCS += Entities/WindParticle.cpp
38
39SRCS += GameStates/CreatingPolygon.cpp
40SRCS += GameStates/GameState.cpp
41SRCS += GameStates/Paused.cpp
42SRCS += GameStates/Running.cpp
43
ec70635e
PG
44SRCS += Effects/Effect.cpp
45SRCS += Effects/Gravity.cpp
46e842c7 46SRCS += Effects/GravityWell.cpp
2c18685d 47SRCS += Effects/Screen.cpp
ec70635e 48
b1d92c2f 49SRCS += config/config.cpp
8f8b6693 50
f7b3b2eb
PG
51SRCS += input/inputManager.cpp
52
44b079f8
PG
53SRCS += graphics/graphics.cpp
54
f4b779e4 55OBJSDIR := ../objs/
44b079f8 56OBJS := ${SRCS:.cpp=.o}
f4b779e4
PG
57OBJS := $(addprefix ${OBJSDIR},${OBJS})
58
59DEPSDIR := ../deps/
60DEPS := ${SRCS:.cpp=.d}
61DEPS := $(addprefix ${DEPSDIR},${DEPS})
44b079f8 62
a4bb9ac2 63HRDS := ${SRCS:.cpp=.h}
5d5a6f3f 64HRDS := $(filter-out main.h,$HRDS) # remove main.h
a4bb9ac2 65HRDS += debug.h
ec70635e 66
a4bb9ac2
PG
67HRDS += graphics/colors.h
68
69TARS := ${SRCS} ${HRDS} Makefile
ad9f1fb6 70
ad9f1fb6 71
393654cf
PG
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
ad9f1fb6 85
046b034c
PG
86.PHONY: all
87all: ${TARGET}
ad9f1fb6 88
046b034c 89${TARGET}: ${OBJS}
393654cf 90 ${Q1}echo "${CXX}: $@"
eb0c55e7 91 ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS}
ad9f1fb6 92
a4bb9ac2 93# rule to make a depend file from a .cpp
f4b779e4 94${DEPSDIR}%.d: %.cpp
393654cf
PG
95 ${Q1}echo "DEP: $@"
96 ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
ad9f1fb6 97
a4bb9ac2 98# rule to make an object file from a .cpp
f4b779e4 99${OBJSDIR}%.o: %.cpp
393654cf
PG
100 ${Q1}echo "${CXX}: $@"
101 ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
054d658f 102
ad9f1fb6 103
046b034c 104.PHONY: clean
ad9f1fb6 105clean:
393654cf
PG
106 ${Q1}echo "CLEAN: OBJS"
107 ${Q2}rm -f ${OBJS}
108 ${Q1}echo "CLEAN: TARGET"
109 ${Q2}rm -f ${TARGET}
ad9f1fb6 110
046b034c 111.PHONY: distclean
ad9f1fb6 112distclean: clean
f4b779e4
PG
113 ${Q1}echo "CLEAN: DEPS"
114 ${Q2}rm -f ${DEPS}
393654cf
PG
115 ${Q1}echo "CLEAN: tags prof gmon.out"
116 ${Q2}rm -f tags prof gmon.out
ad9f1fb6 117
046b034c
PG
118tags: ${SRCS}
119 ctags $^
120
7adc59fe 121.PHONY: tar
8381f595
PG
122tar: ../physics.tar.bz2
123
124.PHONY: ../physics.tar.bz2
125../physics.tar.bz2:
126 @echo "git-archive: Warning, archives HEAD not current"
a4bb9ac2
PG
127 ${Q1}echo "git-archive: ../physics.tar.bz2"
128 ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2
ad9f1fb6 129
046b034c
PG
130.PHONY: run
131run: all
27b74820 132 ${TARGET}
ad9f1fb6 133
6aad402a
PG
134.PHONY: gdb
135gdb: all
136 gdb ${TARGET}
137
63a52c99
PG
138.PHONY: val
139val: all
e861d993 140 valgrind ${VALFLAGS} ${TARGET}
63a52c99
PG
141
142.PHONY: prof
143prof: all
144 ${TARGET}
145 gprof -b ${TARGET} > prof
146 kprof -f prof
ad9f1fb6 147
f4b779e4 148-include ${DEPS}