From 466ce08d3c5946b1215be52a26dfc51d38c740a2 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Wed, 16 Jul 2008 23:49:50 -0400 Subject: [PATCH] switched to a better depend system --- src/.gitignore | 1 + src/Makefile | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) 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} -- 2.10.2