From 599022308c89ddba2e30f40d8877aad175ec05d5 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Sat, 13 Jun 2009 18:46:13 -0400 Subject: [PATCH] setup save/restore for includes --- lib/dir.mk | 18 ++++++++++++------ lib/src/dir.mk | 37 +++++++++++++++++++++++++++++++++++-- lib/src/locks/dir.mk | 39 ++++++++++++++++++++++++++++++++++++--- tests/dir.mk | 16 ++++++++++------ tests/src/1/dir.mk | 43 +++++++++++++++++++++++++++++++++++-------- tests/src/1/rules.mk | 2 +- tests/src/dir.mk | 37 +++++++++++++++++++++++++++++++++++-- tests/src/printTrace/dir.mk | 43 +++++++++++++++++++++++++++++++++++-------- tests/src/printTrace/rules.mk | 2 +- 9 files changed, 200 insertions(+), 37 deletions(-) diff --git a/lib/dir.mk b/lib/dir.mk index b4b70f8..830486b 100644 --- a/lib/dir.mk +++ b/lib/dir.mk @@ -1,16 +1,22 @@ -DIRNAME := lib -P := ${DIRNAME} +T_DIRNAME := lib + +################################################################################ + +# top define +DIRNAME := ${T_DIRNAME} +D := ${DIRNAME} +P := $D CURDIR := ${DIRNAME}/ +T_DIRNAME := + include ${CURDIR}${G_VARSMK} include ${CURDIR}${G_LISTSMK} - # steps on variables - include ${SRCSDIR_$P}${G_DIRMK} - # Restore variables - CURDIR := lib/ +include ${SRCSDIR_$P}${G_DIRMK} + include ${CURDIR}${G_TVARSMK} include ${CURDIR}${G_RULESMK} diff --git a/lib/src/dir.mk b/lib/src/dir.mk index 70a37db..37c1041 100644 --- a/lib/src/dir.mk +++ b/lib/src/dir.mk @@ -1,7 +1,40 @@ -DIRNAME := src -CURDIR := lib/${DIRNAME}/ +T_DIRNAME := src + +################################################################################ + +# save +T := $D_TEMP + DIRNAME_$T := ${DIRNAME} + D_$T := $D + + DIRNAME := ${T_DIRNAME} + D := $D_${DIRNAME} + + DIRNAME_$D := ${DIRNAME_$T} + D_$D := ${D_$T} + + DIRNAME_$T := + D_$T := +T := + +T_DIRNAME := + +CURDIR_$D := ${CURDIR} +CURDIR := ${CURDIR_$D}${DIRNAME}/ + +# top define SRCPATH := + include ${CURDIR}${G_FILESMK} include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS})) + + +# restore + +CURDIR := ${CURDIR_$D} +SRCPATH := +DIRNAME := ${DIRNAME_$D} +D := ${D_$D} + diff --git a/lib/src/locks/dir.mk b/lib/src/locks/dir.mk index 96f7fe7..c5befc9 100644 --- a/lib/src/locks/dir.mk +++ b/lib/src/locks/dir.mk @@ -1,7 +1,40 @@ -DIRNAME := locks -CURDIR := lib/src/${DIRNAME}/ -SRCPATH := ${DIRNAME}/ +T_DIRNAME := locks + +################################################################################ + +# save +T := $D_TEMP + DIRNAME_$T := ${DIRNAME} + D_$T := $D + + DIRNAME := ${T_DIRNAME} + D := $D_${DIRNAME} + + DIRNAME_$D := ${DIRNAME_$T} + D_$D := ${D_$T} + + DIRNAME_$T := + D_$T := +T := + +T_DIRNAME := + +CURDIR_$D := ${CURDIR} +CURDIR := ${CURDIR_$D}${DIRNAME}/ + +SRCPATH_$D := ${SRCPATH} +SRCPATH := ${SRCPATH_$D}${DIRNAME}/ + include ${CURDIR}${G_FILESMK} include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS})) + + +# restore + +CURDIR := ${CURDIR_$D} +SRCPATH := ${SRCPATH_$D} +DIRNAME := ${DIRNAME_$D} +D := ${D_$D} + diff --git a/tests/dir.mk b/tests/dir.mk index 2559d47..6c4595f 100644 --- a/tests/dir.mk +++ b/tests/dir.mk @@ -1,18 +1,22 @@ -DIRNAME := tests -P := ${DIRNAME} +T_DIRNAME := tests + +################################################################################ + +# top define +DIRNAME := ${T_DIRNAME} +D := ${DIRNAME} +P := $D CURDIR := ${DIRNAME}/ +T_DIRNAME := + include ${CURDIR}${G_VARSMK} include ${CURDIR}${G_LISTSMK} -# steps on variables include ${SRCSDIR_$P}${G_DIRMK} -# Restore variables -CURDIR := tests/ - include ${CURDIR}${G_TVARSMK} include ${CURDIR}${G_RULESMK} diff --git a/tests/src/1/dir.mk b/tests/src/1/dir.mk index e29d2ea..d1ce45b 100644 --- a/tests/src/1/dir.mk +++ b/tests/src/1/dir.mk @@ -1,8 +1,31 @@ -DIRNAME := 1 -D := tests_src_${DIRNAME} -CURDIR := tests/src/${DIRNAME}/ -SRCPATH := ${DIRNAME}/ +T_DIRNAME := 1 + +################################################################################ + +# save +T := $D_TEMP + DIRNAME_$T := ${DIRNAME} + D_$T := $D + + DIRNAME := ${T_DIRNAME} + D := $D_${DIRNAME} + + DIRNAME_$D := ${DIRNAME_$T} + D_$D := ${D_$T} + + DIRNAME_$T := + D_$T := +T := + +T_DIRNAME := + +CURDIR_$D := ${CURDIR} +CURDIR := ${CURDIR_$D}${DIRNAME}/ + +SRCPATH_$D := ${SRCPATH} +SRCPATH := ${SRCPATH_$D}${DIRNAME}/ + include ${CURDIR}${G_VARSMK} @@ -12,10 +35,6 @@ include ${CURDIR}${G_FILESMK} include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS})) -# restore -CURDIR := tests/src/1/ -SRCPATH := 1/ - L_SRCS_$P += ${L_SRCS_$D} L_OBJS_$P += ${L_OBJS_$D} L_DEPS_$P += ${L_DEPS_$D} @@ -24,3 +43,11 @@ include ${CURDIR}${G_TVARSMK} include ${CURDIR}${G_RULESMK} + +# restore + +CURDIR := ${CURDIR_$D} +SRCPATH := ${SRCPATH_$D} +DIRNAME := ${DIRNAME_$D} +D := ${D_$D} + diff --git a/tests/src/1/rules.mk b/tests/src/1/rules.mk index 5d34bd0..21bf89b 100644 --- a/tests/src/1/rules.mk +++ b/tests/src/1/rules.mk @@ -1,6 +1,6 @@ ${G_TESTS}: ${TARGET_$D} -${G_TESTS}_${DIRNAME}: ${TARGET_$D} +${G_TESTS}-${DIRNAME}: ${TARGET_$D} # HACK ${TARGETTMP_$D}: tests/bind/libbear.so.0 diff --git a/tests/src/dir.mk b/tests/src/dir.mk index 8f7f596..37c1041 100644 --- a/tests/src/dir.mk +++ b/tests/src/dir.mk @@ -1,7 +1,40 @@ -DIRNAME := src -CURDIR := tests/${DIRNAME}/ +T_DIRNAME := src + +################################################################################ + +# save +T := $D_TEMP + DIRNAME_$T := ${DIRNAME} + D_$T := $D + + DIRNAME := ${T_DIRNAME} + D := $D_${DIRNAME} + + DIRNAME_$D := ${DIRNAME_$T} + D_$D := ${D_$T} + + DIRNAME_$T := + D_$T := +T := + +T_DIRNAME := + +CURDIR_$D := ${CURDIR} +CURDIR := ${CURDIR_$D}${DIRNAME}/ + +# top define SRCPATH := + include ${CURDIR}${G_FILESMK} include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS})) + + +# restore + +CURDIR := ${CURDIR_$D} +SRCPATH := +DIRNAME := ${DIRNAME_$D} +D := ${D_$D} + diff --git a/tests/src/printTrace/dir.mk b/tests/src/printTrace/dir.mk index 75d8d52..08285b6 100644 --- a/tests/src/printTrace/dir.mk +++ b/tests/src/printTrace/dir.mk @@ -1,8 +1,31 @@ -DIRNAME := printTrace -D := tests_src_${DIRNAME} -CURDIR := tests/src/${DIRNAME}/ -SRCPATH := ${DIRNAME}/ +T_DIRNAME := printTrace + +################################################################################ + +# save +T := $D_TEMP + DIRNAME_$T := ${DIRNAME} + D_$T := $D + + DIRNAME := ${T_DIRNAME} + D := $D_${DIRNAME} + + DIRNAME_$D := ${DIRNAME_$T} + D_$D := ${D_$T} + + DIRNAME_$T := + D_$T := +T := + +T_DIRNAME := + +CURDIR_$D := ${CURDIR} +CURDIR := ${CURDIR_$D}${DIRNAME}/ + +SRCPATH_$D := ${SRCPATH} +SRCPATH := ${SRCPATH_$D}${DIRNAME}/ + include ${CURDIR}${G_VARSMK} @@ -12,10 +35,6 @@ include ${CURDIR}${G_FILESMK} include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS})) -# restore -CURDIR := tests/src/printTrace/ -SRCPATH := printTrace/ - L_SRCS_$P += ${L_SRCS_$D} L_OBJS_$P += ${L_OBJS_$D} L_DEPS_$P += ${L_DEPS_$D} @@ -24,3 +43,11 @@ include ${CURDIR}${G_TVARSMK} include ${CURDIR}${G_RULESMK} + +# restore + +CURDIR := ${CURDIR_$D} +SRCPATH := ${SRCPATH_$D} +DIRNAME := ${DIRNAME_$D} +D := ${D_$D} + diff --git a/tests/src/printTrace/rules.mk b/tests/src/printTrace/rules.mk index 5d34bd0..21bf89b 100644 --- a/tests/src/printTrace/rules.mk +++ b/tests/src/printTrace/rules.mk @@ -1,6 +1,6 @@ ${G_TESTS}: ${TARGET_$D} -${G_TESTS}_${DIRNAME}: ${TARGET_$D} +${G_TESTS}-${DIRNAME}: ${TARGET_$D} # HACK ${TARGETTMP_$D}: tests/bind/libbear.so.0 -- 2.10.2