X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=blobdiff_plain;f=src%2FMakefile;h=14cc64ba16d72b97885a63c9af32279eaeb16108;hp=1ebf227b4032f81eede4f7c3a5e606c1187cbbd2;hb=42f62a7503a4d516020b6222eecb3a30ccc66127;hpb=67b5017fa0546c38ca7ad765613b421514cc7d07 diff --git a/src/Makefile b/src/Makefile index 1ebf227..14cc64b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,6 +35,9 @@ DEPSDIR := ../deps/ DEPS := ${SRCS:.cpp=.d} DEPS := $(addprefix ${DEPSDIR},${DEPS}) +BLDDIRS := $(addprefix ${DEPSDIR},${DIRS}) $(addprefix ${OBJSDIR},${DIRS}) +BLDDIRS := $(addsuffix /,${BLDDIRS}) + VERBOSE := 0 @@ -53,17 +56,22 @@ endif .PHONY: all all: ${TARGET} +# how to link the main target ${TARGET}: ${OBJS} ${Q1}echo "${CXX}: $@" ${Q2}${CXX} ${CXXFLAGS} -o $@ $^ ${LIBS} +# how to make a directory +${BLDDIRS}: + ${Q2}mkdir -p $@ + # rule to make a depend file from a .cpp -${DEPSDIR}%.d: %.cpp +${DEPSDIR}%.d: %.cpp | ${BLDDIRS} ${Q1}echo "DEP: $@" ${Q2}${CXX} -MM ${CXXFLAGS} $< | sed 's,\(^.*\):,${OBJSDIR}\1 $@:,' > $@ # rule to make an object file from a .cpp -${OBJSDIR}%.o: %.cpp +${OBJSDIR}%.o: %.cpp | ${BLDDIRS} ${Q1}echo "${CXX}: $@" ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $<