Effects changed to delta system
[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
054d658f 17SRCS += entityCreator.cpp
046b034c 18SRCS += game.cpp
046b034c
PG
19SRCS += main.cpp
20SRCS += mathw.cpp
21SRCS += ticks.cpp
22SRCS += Vector2.cpp
7cbd4505 23SRCS += handleSignal.cpp
046b034c
PG
24
25SRCS += Entities/Ball.cpp
26SRCS += Entities/Entity.cpp
27SRCS += Entities/Line.cpp
28SRCS += Entities/Particle.cpp
29SRCS += Entities/PhysicsEntity.cpp
30SRCS += Entities/Point.cpp
31SRCS += Entities/Polygon.cpp
32SRCS += Entities/WindParticle.cpp
33
34SRCS += GameStates/CreatingPolygon.cpp
35SRCS += GameStates/GameState.cpp
36SRCS += GameStates/Paused.cpp
37SRCS += GameStates/Running.cpp
38
ec70635e
PG
39SRCS += Effects/Effect.cpp
40SRCS += Effects/Gravity.cpp
41
f7b3b2eb
PG
42SRCS += input/inputManager.cpp
43
44b079f8
PG
44SRCS += graphics/graphics.cpp
45
46OBJS := ${SRCS:.cpp=.o}
a4bb9ac2 47DEPENDS := ${SRCS:.cpp=.d}
44b079f8 48
a4bb9ac2
PG
49HRDS := ${SRCS:.cpp=.h}
50HRDS := ${HRDS:main.h=} # remove main.h
51HRDS += debug.h
ec70635e 52
a4bb9ac2
PG
53HRDS += graphics/colors.h
54
55TARS := ${SRCS} ${HRDS} Makefile
ad9f1fb6 56
ad9f1fb6 57
393654cf
PG
58VERBOSE := 0
59
60ifeq (${VERBOSE},0)
61 # quiet the echo command
62 Q1 := @
63 # quiet the command that is `replaced' by an echo
64 Q2 := @
65else
66 # EAT the echo command as if it was not there
67 Q1 := @true # NOTE: the space between @true and the # is VERY important!!
68 # do not quiet the command output
69 Q2 :=
70endif
ad9f1fb6 71
046b034c
PG
72.PHONY: all
73all: ${TARGET}
ad9f1fb6 74
046b034c 75${TARGET}: ${OBJS}
393654cf
PG
76 ${Q1}echo "${CXX}: $@"
77 ${Q2}${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
ad9f1fb6 78
a4bb9ac2 79# rule to make a depend file from a .cpp
466ce08d 80%.d: %.cpp
393654cf
PG
81 ${Q1}echo "DEP: $@"
82 ${Q2}${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
ad9f1fb6 83
a4bb9ac2 84# rule to make an object file from a .cpp
054d658f 85%.o: %.cpp
393654cf
PG
86 ${Q1}echo "${CXX}: $@"
87 ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<
054d658f 88
ad9f1fb6 89
046b034c 90.PHONY: clean
ad9f1fb6 91clean:
393654cf
PG
92 ${Q1}echo "CLEAN: OBJS"
93 ${Q2}rm -f ${OBJS}
94 ${Q1}echo "CLEAN: TARGET"
95 ${Q2}rm -f ${TARGET}
ad9f1fb6 96
046b034c 97.PHONY: distclean
ad9f1fb6 98distclean: clean
393654cf
PG
99 ${Q1}echo "CLEAN: DEPENDS"
100 ${Q2}rm -f ${DEPENDS}
101 ${Q1}echo "CLEAN: tags prof gmon.out"
102 ${Q2}rm -f tags prof gmon.out
ad9f1fb6 103
046b034c
PG
104tags: ${SRCS}
105 ctags $^
106
a4bb9ac2 107tar:
7dd353d9 108 ${Q1}echo "tar: physics.tar.bz2"
a4bb9ac2
PG
109 ${Q2}rm -f physics.tar # prevents appending
110 ${Q2}for f in ${TARS}; do\
111 tar -C ../.. -rf physics.tar "physics/src/$$f"; done
112 ${Q2}bzip2 physics.tar
ad9f1fb6 113
a4bb9ac2
PG
114git-tar:
115 ${Q1}echo "git-archive: ../physics.tar.bz2"
116 ${Q2}cd ..; git-archive --prefix=physics/ HEAD | bzip2 > physics.tar.bz2
ad9f1fb6 117
046b034c
PG
118.PHONY: run
119run: all
27b74820 120 ${TARGET}
ad9f1fb6 121
63a52c99
PG
122.PHONY: val
123val: all
f72f4a59 124 valgrind --leak-check=full ${TARGET}
63a52c99
PG
125
126.PHONY: prof
127prof: all
128 ${TARGET}
129 gprof -b ${TARGET} > prof
130 kprof -f prof
ad9f1fb6 131
466ce08d 132-include ${DEPENDS}