prof and valgrind options added to Makefile
[physics.git] / src / Makefile
index 4a51706..915e4ed 100644 (file)
@@ -1,14 +1,18 @@
 
-LIBGL = -lGL -lGLU
-LIBSDL = `sdl-config --libs`
-LIBS = ${LIBSDL} ${LIBGL}
+LIBGL := -lGL -lGLU
+LIBSDL := `sdl-config --libs`
+LIBS := ${LIBSDL} ${LIBGL}
+
+OPTFLAGS := -O2
+DBGFLAGS := -ggdb
+PRFFLAGS := ${DBGFLAGS} -pg
+
+#CXX := g++
+CXXFLAGS := -Wall -pedantic -ansi ${DBGFLAGS}
 
-CXX = g++
-CXXFLAGS = -ggdb -Wall -pedantic
 
 SRCS := entityManager.cpp
 SRCS += game.cpp
-SRCS += graphics.cpp
 SRCS += main.cpp
 SRCS += mathw.cpp
 SRCS += ticks.cpp
@@ -30,10 +34,13 @@ SRCS += GameStates/Running.cpp
 
 SRCS += input/inputManager.cpp
 
-OBJS = ${SRCS:.cpp=.o}
+SRCS += graphics/graphics.cpp
+
+OBJS := ${SRCS:.cpp=.o}
+
 
-TARGET = ../run_physics
-DEPEND = depend.mk
+TARGET := ../run_physics
+DEPEND := depend.mk
 
 
 .PHONY: all
@@ -49,7 +56,7 @@ depend: ${SRCS}
 
 .PHONY: clean
 clean:
-       rm -f ${OBJS} ${TARGET} *~
+       rm -f ${OBJS} ${TARGET} *~ prof gmon.out
 
 .PHONY: distclean
 distclean: clean
@@ -60,12 +67,21 @@ tags: ${SRCS}
        ctags $^
 
 tar: clean
-       cd ..; tar -cjf bluestar.tar.bz2 images/ source/
+       cd ..; tar -cjf physics.tar.bz2 src/
 
 
 .PHONY: run
 run: all
        ${TARGET}
 
-include ${DEPEND}
+.PHONY: val
+val: all
+       valgrind ${TARGET}
+
+.PHONY: prof
+prof: all
+       ${TARGET}
+       gprof -b ${TARGET} > prof
+       kprof -f prof
 
+include ${DEPEND}