From: Patrik Gornicz Date: Thu, 17 Jul 2008 03:49:50 +0000 (-0400) Subject: switched to a better depend system X-Git-Tag: v0.01~30 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=commitdiff_plain;h=466ce08d3c5946b1215be52a26dfc51d38c740a2 switched to a better depend system --- diff --git a/src/.gitignore b/src/.gitignore index 5761abc..6142305 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1 +1,2 @@ *.o +*.d diff --git a/src/Makefile b/src/Makefile index 915e4ed..77339f0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -40,7 +40,7 @@ OBJS := ${SRCS:.cpp=.o} TARGET := ../run_physics -DEPEND := depend.mk +DEPENDS := ${SRCS:.cpp=.d} .PHONY: all @@ -48,10 +48,18 @@ all: ${TARGET} ${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 @@ -60,8 +68,7 @@ clean: .PHONY: distclean distclean: clean - rm -f tags depend.mk - touch depend.mk + rm -f tags ${DEPENDS} tags: ${SRCS} ctags $^ @@ -84,4 +91,4 @@ prof: all gprof -b ${TARGET} > prof kprof -f prof -include ${DEPEND} +-include ${DEPENDS}