.SECONDEXPANSION:
# The first and therefor default rule
-# targets append themselves to this to be built by all
.PHONY: default
default:
${G_LIB}: ${TARGET_$P}
-${G_LIB_OBJS}: ${L_OBJS_$P}
-${G_LIB_DEPS}: ${L_DEPS_$P}
+${G_OBJS_LIB}: ${L_OBJS_$P}
+${G_DEPS_LIB}: ${L_DEPS_$P}
# how to link the main target
${Q2}${CXX} -MM ${CXXFLAGS} $< ${INCFLAGS} | sed 's/\(^.*\):/$(subst /,\/,${@:${DEPSDIR}%.d=${OBJSDIR}%.o} $@):/' > $@
-L_CLEANCMDS += $P-cleanbin
-cleanbin: $P-cleanbin
-.PHONY: $P-cleanbin
-$P-cleanbin:
+L_CLEANCMDS += cleanbin-$P
+cleanbin: cleanbin-$P
+.PHONY: cleanbin-$P
+cleanbin-$P:
${Q1}${PRNTFMT} "rm" "${WORKINGDIR}"
${Q2}rm -rf ${WORKINGDIR}
-L_CLEANCMDS += $P-cleanobjs
-cleanobjs: $P-cleanobjs
-.PHONY: $P-cleanobjs
-$P-cleanobjs:
+L_CLEANCMDS += cleanobjs-$P
+cleanobjs: cleanobjs-$P
+.PHONY: cleanobjs-$P
+cleanobjs-$P:
${Q1}${PRNTFMT} "rm" "${OBJSDIR}"
${Q2}rm -rf ${OBJSDIR}
-L_CLEANCMDS += $P-cleandeps
-cleandeps: $P-cleandeps
-.PHONY: $P-cleandeps
-$P-cleandeps:
+L_CLEANCMDS += cleandeps-$P
+cleandeps: cleandeps-$P
+.PHONY: cleandeps-$P
+cleandeps-$P:
${Q1}${PRNTFMT} "rm" "${DEPSDIR}"
${Q2}rm -rf ${DEPSDIR}
-L_CLEANCMDS += $P-clean
-clean: $P-clean
-.PHONY: $P-clean
-$P-clean: $P-cleanobjs $P-cleanbin
+L_CLEANCMDS += clean-$P
+clean: clean-$P
+.PHONY: clean-$P
+clean-$P: cleanobjs-$P cleanbin-$P
-L_CLEANCMDS += $P-cleanall
-cleanall: $P-cleanall
-.PHONY: $P-cleanall
-$P-cleanall: $P-cleanbin $P-cleanobjs $P-cleandeps
+L_CLEANCMDS += cleanall-$P
+cleanall: cleanall-$P
+.PHONY: cleanall-$P
+cleanall-$P: cleanbin-$P cleanobjs-$P cleandeps-$P
${TARGETTMP_$P}: LNKFLAGS := ${LNKFLAGS_$P}
${TARGETTMP_$P}: LIBS := ${LIBS_$P}
-$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
-$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
-$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
-$P-clean: TARGET := ${TARGET_$P}
+cleanbin-$P: WORKINGDIR := ${WORKINGDIR_$P}
+cleanobjs-$P: OBJSDIR := ${OBJSDIR_$P}
+cleandeps-$P: DEPSDIR := ${DEPSDIR_$P}
-# LIB: the target of the lib directory
G_LIB := lib
.PHONY: ${G_LIB}
-G_LIB_OBJS := lib-objs
-.PHONY: ${G_LIB_OBJS}
+G_OBJS_LIB := objs-lib
+.PHONY: ${G_OBJS_LIB}
+
+G_DEPS_LIB := deps-lib
+.PHONY: ${G_DEPS_LIB}
-G_LIB_DEPS := lib-deps
-.PHONY: ${G_LIB_DEPS}
-# TESTS: build all of the tests
G_TESTS := tests
.PHONY: ${G_TESTS}
-G_TESTS_OBJS := tests-objs
-.PHONY: ${G_TESTS_OBJS}
+G_OBJS_TESTS := objs-tests
+.PHONY: ${G_OBJS_TESTS}
+
+G_DEPS_TESTS := deps-tests
+.PHONY: ${G_DEPS_TESTS}
-G_TESTS_DEPS := tests-deps
-.PHONY: ${G_TESTS_DEPS}
-L_CLEANCMDS += cleanbin
+L_CLEANCMDS += cleanbin
.PHONY: cleanbin
cleanbin:
-L_CLEANCMDS += cleanobjs
+L_CLEANCMDS += cleanobjs
.PHONY: cleanobjs
cleanobjs:
-L_CLEANCMDS += cleandeps
+L_CLEANCMDS += cleandeps
.PHONY: cleandeps
cleandeps:
-L_CLEANCMDS += clean
+L_CLEANCMDS += clean
.PHONY: clean
clean: cleanobjs
-L_CLEANCMDS += cleanall
+L_CLEANCMDS += cleanall
.PHONY: cleanall
cleanall: cleanbin cleanobjs cleandeps
+
+
+.PHONY: all
+all: ${G_LIB} ${G_TESTS}
+
+.PHONY: objs
+objs: ${G_OBJS_LIB} ${G_OBJS_TESTS}
+
+.PHONY: deps
+deps: ${G_DEPS_LIB} ${G_DEPS_TESTS}
-${G_TESTS_OBJS}: ${L_OBJS_$P}
-${G_TESTS_DEPS}: ${L_DEPS_$P}
+${G_OBJS_TESTS}: ${L_OBJS_$P}
+${G_DEPS_TESTS}: ${L_DEPS_$P}
# HACK
tests/bind/libbear.so.0: lib/bind/libbear.so.0.0 | $${@D}
${Q2}${CXX} -MM ${CXXFLAGS} $< ${INCFLAGS} | sed 's/\(^.*\):/$(subst /,\/,${@:${DEPSDIR}%.d=${OBJSDIR}%.o} $@):/' > $@
-L_CLEANCMDS += $P-cleanbin
-cleanbin: $P-cleanbin
-.PHONY: $P-cleanbin
-$P-cleanbin:
+L_CLEANCMDS += cleanbin-$P
+cleanbin: cleanbin-$P
+.PHONY: cleanbin-$P
+cleanbin-$P:
${Q1}${PRNTFMT} "rm" "${WORKINGDIR}"
${Q2}rm -rf ${WORKINGDIR}
-L_CLEANCMDS += $P-cleanobjs
-cleanobjs: $P-cleanobjs
-.PHONY: $P-cleanobjs
-$P-cleanobjs:
+L_CLEANCMDS += cleanobjs-$P
+cleanobjs: cleanobjs-$P
+.PHONY: cleanobjs-$P
+cleanobjs-$P:
${Q1}${PRNTFMT} "rm" "${OBJSDIR}"
${Q2}rm -rf ${OBJSDIR}
-L_CLEANCMDS += $P-cleandeps
-cleandeps: $P-cleandeps
-.PHONY: $P-cleandeps
-$P-cleandeps:
+L_CLEANCMDS += cleandeps-$P
+cleandeps: cleandeps-$P
+.PHONY: cleandeps-$P
+cleandeps-$P:
${Q1}${PRNTFMT} "rm" "${DEPSDIR}"
${Q2}rm -rf ${DEPSDIR}
-L_CLEANCMDS += $P-clean
-clean: $P-clean
-.PHONY: $P-clean
-$P-clean: $P-cleanobjs $P-cleanbin
+L_CLEANCMDS += clean-$P
+clean: clean-$P
+.PHONY: clean-$P
+clean-$P: cleanobjs-$P cleanbin-$P
-L_CLEANCMDS += $P-cleanall
-cleanall: $P-cleanall
-.PHONY: $P-cleanall
-$P-cleanall: $P-cleanbin $P-cleanobjs $P-cleandeps
+L_CLEANCMDS += cleanall-$P
+cleanall: cleanall-$P
+.PHONY: cleanall-$P
+cleanall-$P: cleanbin-$P cleanobjs-$P cleandeps-$P
${L_DEPS_$P}: DEPSDIR := ${DEPSDIR_$P}
${L_DEPS_$P}: OBJSDIR := ${OBJSDIR_$P}
-$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
-$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
-$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
+cleanbin-$P: WORKINGDIR := ${WORKINGDIR_$P}
+cleanobjs-$P: OBJSDIR := ${OBJSDIR_$P}
+cleandeps-$P: DEPSDIR := ${DEPSDIR_$P}