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} *~ prof gmon.out
+ 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 $^
gprof -b ${TARGET} > prof
kprof -f prof
-include ${DEPEND}
+-include ${DEPENDS}