fixed makefile hack to get tests depending on libs
authorPatrik Gornicz <Gornicz.P@gmail.com>
Sat, 20 Jun 2009 19:39:33 +0000 (15:39 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Sat, 20 Jun 2009 19:39:33 +0000 (15:39 -0400)
tests can now depend on libs cleanly
tests CANNOT depend on tests
libs CANNOT depend on tests

this fixes the BUILD=FINAL bug when building tests

Makefile
lib/dir.mk
lib/vars.mk
targets.mk
tests/rules.mk
tests/src/1/rules.mk
tests/src/printTrace/rules.mk

index 2c44e89..138bb33 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,11 +18,13 @@ G_LISTSMK   := lists.mk
 G_TVARSMK   := tvars.mk
 
 include ${G_LISTSMK}
+include ${G_VARSMK}
 
 include packages.mk
-include targets.mk
 
-include ${G_VARSMK}
+include lib/${G_VARSMK}
+
+include targets.mk
 
 # include all of the dir.mk
 include lib/${G_DIRMK}
index 9f379fe..70d24f1 100644 (file)
@@ -11,8 +11,6 @@ CURDIR  := ${DIRNAME}/
 
 T_DIRNAME :=
 
-include ${CURDIR}${G_VARSMK}
-
 include ${CURDIR}${G_LISTSMK}
 
 include ${SRCSDIR_$P}${G_DIRMK}
index 0969478..9c851a9 100644 (file)
@@ -1,4 +1,17 @@
 
+T_DIRNAME := lib
+
+################################################################################
+
+# top define
+DIRNAME := ${T_DIRNAME}
+D       := ${DIRNAME}
+P       := ${P_LIB}
+CURDIR  := ${DIRNAME}/
+
+T_DIRNAME :=
+
+
 CXX_$P      := ${G_CXX}
 CXXFLAGS_$P := ${G_CXXFLAGS} -fPIC
 LIBS_$P     := ${G_LIBSDL} ${G_LIBGL}
@@ -45,5 +58,4 @@ endif
 LNKFLAGS_$P := ${G_LNKFLAGS} -shared -Wl,-soname,${SONAME_$P}
 
 TARGETTMP_$P   := ${OBJSDIR_$P}${REALNAME_$P}
-TARGET_$P      := ${WORKINGDIR_$P}${REALNAME_$P}
 
index e7503a6..90e8b6c 100644 (file)
@@ -8,6 +8,9 @@ G_OBJS_LIB := objs-${G_LIB}
 G_DEPS_LIB := deps-${G_LIB}
 .PHONY: ${G_DEPS_LIB}
 
+TARGET_${G_LIB} := ${WORKINGDIR_${G_LIB}}${REALNAME_${G_LIB}}
+
+
 G_TESTS := ${P_TESTS}
 .PHONY: ${G_TESTS}
 
index 67aaab6..303c0ca 100644 (file)
@@ -2,8 +2,8 @@
 ${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}
+# how to copy a library to the tests bin directory
+${WORKINGDIR_$P}${SONAME_${G_LIB}}: ${TARGET_${G_LIB}} | $${@D}
        ${cmd-cp}
 
 # rule to make an object file from a .cpp
index 130bab4..f32fe5f 100644 (file)
@@ -2,8 +2,8 @@
 ${G_TESTS}: ${TARGET_$D}
 ${G_TESTS}-${DIRNAME}: ${TARGET_$D}
 
-# HACK
-${TARGETTMP_$D}: tests/bind/libbear.so.0
+# this test depends on the G_LIB library
+${TARGETTMP_$D}: ${WORKINGDIR_$P}${SONAME_${G_LIB}}
 
 # how to link the main target
 ${TARGETTMP_$D}: ${L_OBJS_$D} | $${@D}
index 130bab4..f32fe5f 100644 (file)
@@ -2,8 +2,8 @@
 ${G_TESTS}: ${TARGET_$D}
 ${G_TESTS}-${DIRNAME}: ${TARGET_$D}
 
-# HACK
-${TARGETTMP_$D}: tests/bind/libbear.so.0
+# this test depends on the G_LIB library
+${TARGETTMP_$D}: ${WORKINGDIR_$P}${SONAME_${G_LIB}}
 
 # how to link the main target
 ${TARGETTMP_$D}: ${L_OBJS_$D} | $${@D}