TARGET := ../run_physics
-DEPEND := depend.mk
+DEPENDS := ${SRCS:.cpp=.d}
.PHONY: all
${TARGET}: ${OBJS}
${CXX} ${CXXFLAGS} -o ${TARGET} $^ ${LIBS}
+ @echo ""
-.PHONY: depend
-depend: ${SRCS}
- ${CXX} -MM $^ > ${DEPEND}
+# how to make a depend file from a source file
+%.d: %.cpp
+ @echo "DEP: $@"
+ @${CXX} -M ${CXXFLAGS} $< | sed 's,: , $@: ,' > $@
+
+#@${CXX} -M ${CXXFLAGS} $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@
.PHONY: clean
clean:
- rm -f ${OBJS} ${TARGET} *~
+ rm -f ${OBJS} ${TARGET}
.PHONY: distclean
distclean: clean
- rm -f tags depend.mk
- touch depend.mk
+ rm -f ${DEPENDS} tags prof gmon.out
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 ${DEPENDS}