fixed bugs with test system not using the local library
authorPatrik Gornicz <Gornicz.P@gmail.com>
Sun, 31 May 2009 02:49:06 +0000 (22:49 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Sun, 31 May 2009 02:49:06 +0000 (22:49 -0400)
test/1/Makefile
test/1/libs/libbear.so.0 [new symlink]
test/README [new file with mode: 0644]

index 1d02c1a..d75efc9 100644 (file)
@@ -11,19 +11,20 @@ WORKINGDIR  := bind/
 
 LIBGL   := -lGL -lGLU
 LIBSDL  := `sdl-config --libs`
-LIBBEAR := -lbear
-LIBS    := ${LIBSDL} ${LIBGL} ${LIBBEAR}
+LIBS    := ${LIBSDL} ${LIBGL}
 
+SRCLIBSDIR  := libs/
+DSTLIBSDIR  := ${WORKINGDIR}
 
-LINKERNAME  := libpg.so
-SONAME      := libpg.so.0
-REALNAME    := libpg.so.0.0
+LIBSCPY := # := start
+LIBSCPY += libbear.so.0
+LIBSCPY := $(addprefix ${DSTLIBSDIR},${LIBSCPY})
 
-TARGETNAME  := test-1
+TARGETNAME  := test
 TARGETTMP   := ${OBJSDIR}${TARGETNAME}
 TARGET      := ${WORKINGDIR}${TARGETNAME}
 
-RPATH    := ${LIBDIR}/bind/
+RPATH       := ./
 
 OPTFLAGS := -O2
 DBGFLAGS := -ggdb
@@ -58,7 +59,7 @@ endif
 
 # The first and therefor default rule
 .PHONY: all
-all: ${TARGET}
+all: ${TARGET} ${LIBSCPY}
 
 
 # lists populated by dir.mk files in subdirectories
@@ -79,11 +80,13 @@ OBJSBLDDIRS := ${OBJSDIR} $(addprefix ${OBJSDIR},${DIRS})
 BLDDIRS     := # := start
 BLDDIRS     += ${OBJSBLDDIRS}
 BLDDIRS     += ${DEPSBLDDIRS}
+BLDDIRS     += ${DSTLIBSDIR}
 BLDDIRS     += ${WORKINGDIR}
+BLDDIRS     := $(sort ${BLDDIRS}) # remove possible duplicates
 
 
 # how to link the main target
-${TARGETTMP}: ${OBJS} | $${@D}
+${TARGETTMP}: ${OBJS} ${LIBSCPY} | $${@D}
        ${Q1}${PRNTFMT} "${CXX}" "$@"
        ${Q2}${CXX} ${CXXFLAGS} ${LNKFLAGS} -o $@ $^ ${LIBS}
 
@@ -92,6 +95,11 @@ ${TARGET}: ${TARGETTMP} | $${@D}
        ${Q1}${PRNTFMT} "cp" "$@"
        ${Q2}cp $< $@
 
+# rule to copy the library files into the working directory
+${DSTLIBSDIR}%: ${SRCLIBSDIR}% | $$(dir $$@)
+       ${Q1}${PRNTFMT} "cp" "$@"
+       ${Q2}cp $< $@
+
 # how to make a directory
 ${BLDDIRS}:
        ${Q1}${PRNTFMT} "mkdir" "$@"
diff --git a/test/1/libs/libbear.so.0 b/test/1/libs/libbear.so.0
new file mode 120000 (symlink)
index 0000000..842f36a
--- /dev/null
@@ -0,0 +1 @@
+../../../bind/libbear.so.0.0
\ No newline at end of file
diff --git a/test/README b/test/README
new file mode 100644 (file)
index 0000000..a90756d
--- /dev/null
@@ -0,0 +1,11 @@
+I've setup a very simple test system.
+
+The Makefile you see in this directory is shared by all the tests using
+symbolic links.
+
+Run make or make run in one of the test directories to build or build+run the
+test.
+
+Enjoy!
+
+Patrik