From: Daniel Axtens Date: Wed, 29 Apr 2015 03:51:00 +0000 (+1000) Subject: Move Makefile.in test-related parts into test/Makefile.in X-Git-Tag: 1.9.9-b1~783 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f06829a17f5735aa84639ed27627e5341af003a8;p=thirdparty%2Fzlib-ng.git Move Makefile.in test-related parts into test/Makefile.in Update configure to create test/Makefile. Update /Makefile.in to call [dist]clean in test/ Signed-off-by: Daniel Axtens --- diff --git a/Makefile.in b/Makefile.in index 81c6294b4..c69175e2d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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] diff --git a/configure b/configure index 1c41b4a1a..094462b88 100755 --- 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 index 000000000..2c3af0a08 --- /dev/null +++ b/test/.gitignore @@ -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 index 000000000..44db06349 --- /dev/null +++ b/test/Makefile.in @@ -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