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