small change to directory handling in Makefile
authorPatrik Gornicz <Gornicz.P@gmail.com>
Mon, 18 May 2009 21:09:56 +0000 (17:09 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Mon, 18 May 2009 21:09:56 +0000 (17:09 -0400)
Makefile

index 2cf55b0..92ae7d2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -144,16 +144,16 @@ uninstall:
        rm /usr/lib/${LINKERNAME}
        rm /usr/lib/${SONAME}
 
-# cause the fancy $$ directory rules to work out
+# cause the fancy $${@D} directory rules to work out
 .SECONDEXPANSION:
 
 # how to link the main target
-${TARGETTMP}: ${OBJS}
+${TARGETTMP}: ${OBJS} | $${@D}
        ${Q1}${PRNTFMT} "${CXX}" "$@"
        ${Q2}${CXX} ${CXXFLAGS} ${LNKFLAGS} -o $@ $^ ${LIBS}
 
 # rule to copy tmp target to working directory
-${TARGET}: ${TARGETTMP} | ${WORKINGDIR}
+${TARGET}: ${TARGETTMP} | $${@D}
        ${Q1}${PRNTFMT} "cp" "$@"
        ${Q2}cp $< $@
 
@@ -163,14 +163,14 @@ ${BLDDIRS}:
        ${Q2}mkdir -p $@
 
 # rule to make an object file from a .cpp
-${OBJSDIR}%.o: ${SRCSDIR}%.cpp | $$(dir $$@)
+${OBJSDIR}%.o: ${SRCSDIR}%.cpp | $${@D}
        ${Q1}${PRNTFMT} "${CXX}" "$@"
        ${Q2}${CXX} ${CXXFLAGS} -c -o $@ $< ${INCFLAGS}
 
 # rule to make a depend file from a .cpp
 #   be clever and escape the / chars in file paths
 #   DON'T simply use another sed delimiter or it can't appear in the file paths
-${DEPSDIR}%.d: ${SRCSDIR}%.cpp | $$(dir $$@)
+${DEPSDIR}%.d: ${SRCSDIR}%.cpp | $${@D}
        ${Q1}${PRNTFMT} "DEP" "$@"
        ${Q2}${CXX} -MM ${CXXFLAGS} $< ${INCFLAGS} | \
                sed 's/\(^.*\):/$(subst /,\/,${OBJSDIR}\1 $@):/' > $@