]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Move Makefile.in test-related parts into test/Makefile.in
authorDaniel Axtens <dja@axtens.net>
Wed, 29 Apr 2015 03:51:00 +0000 (13:51 +1000)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Thu, 28 Apr 2016 11:59:01 +0000 (13:59 +0200)
Update configure to create test/Makefile.
Update /Makefile.in to call [dist]clean in test/

Signed-off-by: Daniel Axtens <dja@axtens.net>
Makefile.in
configure
test/.gitignore [new file with mode: 0644]
test/Makefile.in [new file with mode: 0644]

index 81c6294b4f33566932aa346d281dd35f4e18fea3..c69175e2d9ab653ae4306efbd0c28add7ab13fd3 100644 (file)
@@ -99,38 +99,8 @@ $(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c
 %.lo: $(ARCHDIR)/%.lo
        -cp $< $@
 
-test: all teststatic testshared
-
-teststatic: static
-       @TMPST=tmpst_$$; \
-       if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
-         echo '                *** zlib test OK ***'; \
-       else \
-         echo '                *** zlib test FAILED ***'; false; \
-       fi; \
-       rm -f $$TMPST
-
-testshared: shared
-       @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
-       LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
-       DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
-       SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
-       TMPSH=tmpsh_$$; \
-       if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
-         echo '                *** zlib shared test OK ***'; \
-       else \
-         echo '                *** zlib shared test FAILED ***'; false; \
-       fi; \
-       rm -f $$TMPSH
-
-test64: all64
-       @TMP64=tmp64_$$; \
-       if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
-         echo '                *** zlib 64-bit test OK ***'; \
-       else \
-         echo '                *** zlib 64-bit test FAILED ***'; false; \
-       fi; \
-       rm -f $$TMP64
+test: all
+       $(MAKE) -C test
 
 infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib.h zconf.h
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c
@@ -284,6 +254,7 @@ zlib.3.pdf: $(SRCDIR)/zlib.3
 mostlyclean: clean
 clean:
        @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi
+       @if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi
        rm -f *.o *.lo *~ \
           example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
           example64$(EXE) minigzip64$(EXE) \
@@ -298,6 +269,7 @@ clean:
 maintainer-clean: distclean
 distclean: clean
        @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi
+       @if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi
        rm -f zlib.pc configure.log zconf.h zconf.h.cmakein
        -@rm -f .DS_Store
 # Reset Makefile if building inside source tree
@@ -315,8 +287,9 @@ distclean: clean
        rm $$TEMPFILE ; fi
 # Cleanup these files if building outside source tree
        @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf Makefile; fi
-# Remove arch directory if building outside source tree
+# Remove arch and test directory if building outside source tree
        @if [ ! -f $(ARCHDIR)/Makefile.in ]; then rm -rf arch; fi
+       @if [ ! -f test/Makefile.in ]; then rm -rf test; fi
 
 tags:
        etags $(SRCDIR)/*.[ch]
index 1c41b4a1ad27ef18c8914e8715175eabe5dde045..094462b8856cd00fc12ce2538f01c85e3867ded2 100755 (executable)
--- a/configure
+++ b/configure
@@ -114,6 +114,8 @@ PIC_OBJC='$(PIC_OBJZ)'
 INSTALLTARGETS="install-shared install-static"
 UNINSTALLTARGETS="uninstall-shared uninstall-static"
 
+TEST="teststatic"
+
 # leave this script, optionally in a bad way
 leave()
 {
@@ -437,7 +439,6 @@ fi
 if test $shared -eq 0; then
   LDSHARED="$CC"
   ALL="static"
-  TEST="all teststatic"
   SHAREDLIB=""
   SHAREDLIBV=""
   SHAREDLIBM=""
@@ -447,7 +448,7 @@ if test $shared -eq 0; then
   echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
 else
   ALL="static shared"
-  TEST="all teststatic testshared"
+  TEST="${TEST} testshared"
 fi
 
 echo >> configure.log
@@ -854,7 +855,6 @@ sed < $SRCDIR/Makefile.in "
 /^OBJC *=/s#=.*#= $OBJC#
 /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
 /^all: */s#:.*#: $ALL#
-/^test: */s#:.*#: $TEST#
 /^install-libs: */s#:.*#: $INSTALLTARGETS#
 /^uninstall-libs: */s#:.*#: $UNINSTALLTARGETS#
 /^ARCHDIR *=/s#=.*#=$ARCHDIR#
@@ -877,6 +877,20 @@ sed < $SRCDIR/$ARCHDIR/Makefile.in "
 /^SRCTOP *=/s#=.*#=$SRCDIR#
 " > $ARCHDIR/Makefile
 
+# Generate Makefile in test dir
+mkdir -p test
+TESTINCLUDES="-I$SRCDIR"
+if [ "$SRCDIR" != "$BUILDDIR" ]; then TESTINCLUDES="${TESTINCLUDES} -I$BUILDDIR"; fi
+sed < $SRCDIR/test/Makefile.in "
+/^CC *=/s#=.*#=$CC#
+/^CFLAGS *=/s#=.*#=$CFLAGS#
+/^EXE *=/s#=.*#=$EXE#
+/^oldtests: */s#:.*#: $TEST#
+/^INCLUDES *=/s#=.*#=$TESTINCLUDES#
+/^SRCDIR *=/s#=.*#=$SRCDIR/test#
+/^SRCTOP *=/s#=.*#=$SRCDIR#
+" > test/Makefile
+
 # create zlib.pc with the configure results
 sed < $SRCDIR/zlib.pc.in "
 /^CC *=/s#=.*#=$CC#
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644 (file)
index 0000000..2c3af0a
--- /dev/null
@@ -0,0 +1,2 @@
+# ignore Makefiles; they're all automatically generated
+Makefile
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644 (file)
index 0000000..44db063
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+# Copyright 2015, Daniel Axtens, IBM Corporation
+# zlib license, see zlib.h
+
+CC=
+CFLAGS=
+EXE=
+SRCDIR=
+SRCTOP=
+INCLUDES=
+TEST_LDFLAGS=-L.. ../libz.a
+
+all: oldtests
+
+oldtests: #set by ../configure
+
+teststatic:
+       @TMPST=tmpst_$$; \
+       if echo hello world | ../minigzip | ../minigzip -d && ../example $$TMPST ; then \
+         echo '                *** zlib test OK ***'; \
+       else \
+         echo '                *** zlib test FAILED ***'; false; \
+       fi; \
+       rm -f $$TMPST
+
+testshared:
+       @LD_LIBRARY_PATH=`pwd`/..:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+       LD_LIBRARYN32_PATH=`pwd`/..:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
+       DYLD_LIBRARY_PATH=`pwd`/..:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
+       SHLIB_PATH=`pwd`/..:$(SHLIB_PATH) ; export SHLIB_PATH; \
+       TMPSH=tmpsh_$$; \
+       if echo hello world | ../minigzipsh | ../minigzipsh -d && ../examplesh $$TMPSH; then \
+         echo '                *** zlib shared test OK ***'; \
+       else \
+         echo '                *** zlib shared test FAILED ***'; false; \
+       fi; \
+       rm -f $$TMPSH
+
+test64:
+       @TMP64=tmp64_$$; \
+       if echo hello world | ../minigzip64 | ../minigzip64 -d && ../example64 $$TMP64; then \
+         echo '                *** zlib 64-bit test OK ***'; \
+       else \
+         echo '                *** zlib 64-bit test FAILED ***'; false; \
+       fi; \
+       rm -f $$TMP64
+
+clean:
+
+distclean:
+       rm -f Makefile