-LIBALLG = `allegro-config --libs release`
-LIBGL = -lGL -lGLU
-LIBSDL = `sdl-config --libs`
-LIBS = ${LIBSDL} ${LIBGL}
+LIBGL := -lGL -lGLU
+LIBSDL := `sdl-config --libs`
+LIBS := ${LIBSDL} ${LIBGL}
-CXX = g++
-CXXFLAGS = -ggdb -Wall -pedantic
+OPTFLAGS := -O2
+DBGFLAGS := -ggdb
+PRFFLAGS := ${DBGFLAGS} -pg
-SRCS = Vector2.cpp ticks.cpp main.cpp game.cpp entityManager.cpp gldraw.cpp graphics.cpp
-OBJS = ${SRCS:.cpp=.o}
+#CXX := g++
+CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS}
-TARGETS = ../run_physics
-DEPEND = depend.mk
-# set suffixes to look for ...
-.SUFFIXES: .cpp .o
+SRCS := entityManager.cpp
+SRCS += game.cpp
+SRCS += main.cpp
+SRCS += mathw.cpp
+SRCS += ticks.cpp
+SRCS += Vector2.cpp
-# set default action for a *.cc to create a *.o
-.cpp.o:
- g++ -c $< ${CXXFLAGS}
+SRCS += Entities/Ball.cpp
+SRCS += Entities/Entity.cpp
+SRCS += Entities/Line.cpp
+SRCS += Entities/Particle.cpp
+SRCS += Entities/PhysicsEntity.cpp
+SRCS += Entities/Point.cpp
+SRCS += Entities/Polygon.cpp
+SRCS += Entities/WindParticle.cpp
-all: ${TARGETS}
+SRCS += GameStates/CreatingPolygon.cpp
+SRCS += GameStates/GameState.cpp
+SRCS += GameStates/Paused.cpp
+SRCS += GameStates/Running.cpp
-depend:
- ${CXX} -MM ${SRCS} > ${DEPEND}
+SRCS += input/inputManager.cpp
-tags:
- ctags ${SRCS}
+SRCS += graphics/graphics.cpp
+OBJS := ${SRCS:.cpp=.o}
+
+
+TARGET := ../run_physics
+DEPEND := depend.mk
+
+
+.PHONY: all
+all: ${TARGET}
+
+${TARGET}: ${OBJS}
+ ${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
+
+.PHONY: depend
+depend: ${SRCS}
+ ${CXX} -MM $^ > ${DEPEND}
+
+
+.PHONY: clean
clean:
- rm -f ${OBJS} ${TARGETS} *~
+ rm -f ${OBJS} ${TARGET} *~ prof gmon.out
+.PHONY: distclean
distclean: clean
rm -f tags depend.mk
touch depend.mk
-# i need to find a nice way of ijnoring .svn folders for the below
+tags: ${SRCS}
+ ctags $^
+
tar: clean
- cd ..; tar -cjf bluestar.tar.bz2 images/ source/
+ cd ..; tar -cjf physics.tar.bz2 src/
-run: ../run_physics
- cd ..; ./run_physics
+.PHONY: run
+run: all
+ ${TARGET}
-../run_physics: ${OBJS}
- ${CXX} ${CXXFLAGS} -o ../run_physics ${OBJS} ${LIBS}
+.PHONY: val
+val: all
+ valgrind ${TARGET}
-Entities.d:
- cd Entities; make
+.PHONY: prof
+prof: all
+ ${TARGET}
+ gprof -b ${TARGET} > prof
+ kprof -f prof
include ${DEPEND}
-