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 $< $@
${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 $@):/' > $@