From: Patrik Gornicz Date: Sat, 13 Jun 2009 21:29:27 +0000 (-0400) Subject: updated target to use only suffixies X-Git-Tag: libbear-premerge~58 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=adc2e516feccf3b3eada9e6b4615399abc22dbd8;p=libbear.git updated target to use only suffixies --- diff --git a/Makefile b/Makefile index 7b8d452..5cf0a31 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ BUILD := DEBUG .SECONDEXPANSION: # The first and therefor default rule -# targets append themselves to this to be built by all .PHONY: default default: diff --git a/lib/rules.mk b/lib/rules.mk index 5f9919a..4f9bffa 100644 --- a/lib/rules.mk +++ b/lib/rules.mk @@ -16,8 +16,8 @@ uninstall: ${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 @@ -48,33 +48,33 @@ ${DEPSDIR_$P}%.d: ${SRCSDIR_$P}%.cpp | $${@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 diff --git a/lib/tvars.mk b/lib/tvars.mk index 7148e05..bd66535 100644 --- a/lib/tvars.mk +++ b/lib/tvars.mk @@ -11,8 +11,7 @@ ${TARGETTMP_$P}: CXXFLAGS := ${CXXFLAGS_$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} diff --git a/targets.mk b/targets.mk index fefa6e3..3b825fc 100644 --- a/targets.mk +++ b/targets.mk @@ -1,40 +1,50 @@ -# 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} diff --git a/tests/rules.mk b/tests/rules.mk index 1be2644..a8faf94 100644 --- a/tests/rules.mk +++ b/tests/rules.mk @@ -1,6 +1,6 @@ -${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} @@ -25,33 +25,33 @@ ${DEPSDIR_$P}%.d: ${SRCSDIR_$P}%.cpp | $${@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 diff --git a/tests/tvars.mk b/tests/tvars.mk index 6afc32d..a062b30 100644 --- a/tests/tvars.mk +++ b/tests/tvars.mk @@ -5,7 +5,7 @@ ${L_OBJS_$P} ${L_DEPS_$P}: INCFLAGS := ${INCFLAGS_$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}