cleaned Make output, added base for entity Creator, and calling hooks
[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
ad9f1fb6 13
046b034c 14SRCS := entityManager.cpp
054d658f 15SRCS += entityCreator.cpp
046b034c 16SRCS += game.cpp
046b034c
PG
17SRCS += main.cpp
18SRCS += mathw.cpp
19SRCS += ticks.cpp
20SRCS += Vector2.cpp
21
22SRCS += Entities/Ball.cpp
23SRCS += Entities/Entity.cpp
24SRCS += Entities/Line.cpp
25SRCS += Entities/Particle.cpp
26SRCS += Entities/PhysicsEntity.cpp
27SRCS += Entities/Point.cpp
28SRCS += Entities/Polygon.cpp
29SRCS += Entities/WindParticle.cpp
30
31SRCS += GameStates/CreatingPolygon.cpp
32SRCS += GameStates/GameState.cpp
33SRCS += GameStates/Paused.cpp
34SRCS += GameStates/Running.cpp
35
f7b3b2eb
PG
36SRCS += input/inputManager.cpp
37
44b079f8
PG
38SRCS += graphics/graphics.cpp
39
40OBJS := ${SRCS:.cpp=.o}
41
ad9f1fb6 42
44b079f8 43TARGET := ../run_physics
466ce08d 44DEPENDS := ${SRCS:.cpp=.d}
ad9f1fb6 45
ad9f1fb6 46
046b034c
PG
47.PHONY: all
48all: ${TARGET}
ad9f1fb6 49
046b034c 50${TARGET}: ${OBJS}
054d658f
PG
51 @echo "${CXX}: $@"
52 @${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
ad9f1fb6 53
466ce08d
PG
54# how to make a depend file from a source file
55%.d: %.cpp
56 @echo "DEP: $@"
57 @${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
466ce08d 58#@${CXX} -M ${CXXFLAGS} $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
ad9f1fb6 59
054d658f
PG
60%.o: %.cpp
61 @echo "${CXX}: $@"
62 @${CXX} ${CXXFLAGS} -c -o $@ $<
63
ad9f1fb6 64
046b034c 65.PHONY: clean
ad9f1fb6 66clean:
1fdcf18d 67 rm -f ${OBJS} ${TARGET}
ad9f1fb6 68
046b034c 69.PHONY: distclean
ad9f1fb6 70distclean: clean
1fdcf18d 71 rm -f ${DEPENDS} tags prof gmon.out
ad9f1fb6 72
046b034c
PG
73tags: ${SRCS}
74 ctags $^
75
ad9f1fb6 76tar: clean
63a52c99 77 cd ..; tar -cjf physics.tar.bz2 src/
ad9f1fb6
PG
78
79
046b034c
PG
80.PHONY: run
81run: all
27b74820 82 ${TARGET}
ad9f1fb6 83
63a52c99
PG
84.PHONY: val
85val: all
86 valgrind ${TARGET}
87
88.PHONY: prof
89prof: all
90 ${TARGET}
91 gprof -b ${TARGET} > prof
92 kprof -f prof
ad9f1fb6 93
466ce08d 94-include ${DEPENDS}