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