L_CLEANCMDS += cleanbin-$T
cleanbin: cleanbin-$T
.PHONY: cleanbin-$T
+cleanbin-$T: CLEANTARGET := ${BINDIR}
cleanbin-$T:
- ${Q1}${PRNTFMT} "rm" "${BINDIR}"
- ${Q2}rm -rf ${BINDIR}
+ ${cmd-rmrec}
L_CLEANCMDS += cleanobjs-$T
cleanobjs: cleanobjs-$T
.PHONY: cleanobjs-$T
+cleanobjs-$T: CLEANTARGET := ${OBJSDIR}
cleanobjs-$T:
- ${Q1}${PRNTFMT} "rm" "${OBJSDIR}"
- ${Q2}rm -rf ${OBJSDIR}
+ ${cmd-rmrec}
L_CLEANCMDS += cleandeps-$T
cleandeps: cleandeps-$T
.PHONY: cleandeps-$T
+cleandeps-$T: CLEANTARGET := ${DEPSDIR}
cleandeps-$T:
- ${Q1}${PRNTFMT} "rm" "${DEPSDIR}"
- ${Q2}rm -rf ${DEPSDIR}
+ ${cmd-rmrec}
L_CLEANCMDS += clean-$T
clean: clean-$T
define cmd-link
- ${Q1}${PRNTFMT} "${CXX}" "$@"
- ${Q2}${CXX} $^ -o $@ ${CXXFLAGS} ${LNKFLAGS} ${LIBS}
+ ${Q1s}${PRNTFMT} "${CXX}" "$@" ${Q1e}
+ ${Q2s}${PRNTFMT} "${CXX}" "$@" ${Q2e}
+ ${Q3s}${CXX} $^ -o $@ ${CXXFLAGS} ${LNKFLAGS} ${LIBS} ${Q3e}
+ ${Q4s}${CXX} $^ -o $@ ${CXXFLAGS} ${LNKFLAGS} ${LIBS} ${Q4e}
endef
define cmd-cp
- ${Q1}${PRNTFMT} "cp" "$@"
- ${Q2}cp $< $@
+ ${Q1s}${PRNTFMT} "cp" "$@" ${Q1e}
+ ${Q2s}${PRNTFMT} "cp" "$@" ${Q2e}
+ ${Q3s}cp $< $@ ${Q3e}
+ ${Q4s}cp $< $@ ${Q4e}
+endef
+
+define cmd-rm
+ ${Q1s}${PRNTFMT} "rm" "${CLEANTARGET}" ${Q1e}
+ ${Q2s}${PRNTFMT} "rm" "${CLEANTARGET}" ${Q2e}
+ ${Q3s}rm -f ${CLEANTARGET} ${Q3e}
+ ${Q4s}rm -f ${CLEANTARGET} ${Q4e}
+endef
+
+define cmd-rmrec
+ ${Q1s}${PRNTFMT} "rm" "${CLEANTARGET}" ${Q1e}
+ ${Q2s}${PRNTFMT} "rm" "${CLEANTARGET}" ${Q2e}
+ ${Q3s}rm -rf ${CLEANTARGET} ${Q3e}
+ ${Q4s}rm -rf ${CLEANTARGET} ${Q4e}
endef
define cmd-cpptoobj
- ${Q1}${PRNTFMT} "${CXX}" "$@"
- ${Q2}${CXX} $< -o $@ ${CXXFLAGS} ${INCFLAGS} -c
+ ${Q1s}${PRNTFMT} "${CXX}" "$@" ${Q1e}
+ ${Q2s}${PRNTFMT} "${CXX}" "$@" ${Q2e}
+ ${Q3s}${CXX} $< -o $@ ${CXXFLAGS} ${INCFLAGS} -c ${Q3e}
+ ${Q4s}${CXX} $< -o $@ ${CXXFLAGS} ${INCFLAGS} -c ${Q4e}
endef
define cmd-cpptodep
- ${Q1}${PRNTFMT} "DEP" "$@"
- ${Q2}${CXX} $< -MF $@ ${CXXFLAGS} ${INCFLAGS} -MM -MQ ${@:${DEPSDIR}%.d=${OBJSDIR}%.o} -MQ $@
+ ${Q1s}${PRNTFMT} "DEP" "$@" ${Q1e}
+ ${Q2s}${PRNTFMT} "DEP" "$@" ${Q2e}
+ ${Q3s}${CXX} $< -MF $@ ${CXXFLAGS} ${INCFLAGS} -MM -MQ ${@:${DEPSDIR}%.d=${OBJSDIR}%.o} -MQ $@ ${Q3e}
+ ${Q4s}${CXX} $< -MF $@ ${CXXFLAGS} ${INCFLAGS} -MM -MQ ${@:${DEPSDIR}%.d=${OBJSDIR}%.o} -MQ $@ ${Q4e}
endef
${L_BLDDIRS}:
- ${Q1}${PRNTFMT} "mkdir" "$@"
- ${Q2}mkdir $@
+ ${Q1s}${PRNTFMT} "mkdir" "$@" ${Q1e}
+ ${Q2s}${PRNTFMT} "mkdir" "$@" ${Q2e}
+ ${Q3s}mkdir $@ ${Q3e}
+ ${Q4s}mkdir $@ ${Q4e}
endif
endif
+LOGFILE := bld.log
+
+$(shell rm -f ${LOGFILE}) # remove the log file from last run
ifeq (${G_BUILD},${B_WIN32})
PRNTFMT := printf "%-12s: %s\n"
VERBOSE := 0
ifeq (${VERBOSE},0)
+ # log the printf command
+ Q1s := @
+ Q1e := >> ${LOGFILE}
# quiet the printf command
- Q1 := @
- # quiet the command that is `replaced' by an echo
- Q2 := @
+ Q2s := @
+ Q2e :=
+ # log the command
+ Q3s := @echo # NOTE: the space between @echo and the # is VERY important!!
+ Q3e := >> ${LOGFILE}
+ # quiet the command
+ Q4s := @
+ Q4e :=
else
- # EAT the printf command as if it was not there
- Q1 := @true # NOTE: the space between @true and the # is VERY important!!
- # do not quiet the command output
- Q2 :=
+ # EAT the logging printf command
+ Q1s := @true # NOTE: the space between @true and the # is VERY important!!
+ Q1e :=
+ # EAT the quiet printf command
+ Q2s := @true # NOTE: the space between @true and the # is VERY important!!
+ Q2e :=
+ # EAT the logging command
+ Q3s := @true # NOTE: the space between @true and the # is VERY important!!
+ Q3e :=
+ # do not quiet the command
+ Q4s :=
+ Q4e :=
endif