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}
+       ${CXX} -MM $^ > ${DEPENDS}
+
+# 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
 
 .PHONY: distclean
 distclean: clean
-       rm -f tags depend.mk
-       touch depend.mk
+       rm -f tags ${DEPENDS}
 
 tags: ${SRCS}
        ctags $^
        gprof -b ${TARGET} > prof
        kprof -f prof
 
-include ${DEPEND}
+-include ${DEPENDS}