Update configure to create test/Makefile.
Update /Makefile.in to call [dist]clean in test/
Signed-off-by: Daniel Axtens <dja@axtens.net>
%.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
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) \
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
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]
INSTALLTARGETS="install-shared install-static"
UNINSTALLTARGETS="uninstall-shared uninstall-static"
+TEST="teststatic"
+
# leave this script, optionally in a bad way
leave()
{
if test $shared -eq 0; then
LDSHARED="$CC"
ALL="static"
- TEST="all teststatic"
SHAREDLIB=""
SHAREDLIBV=""
SHAREDLIBM=""
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
/^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#
/^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#
--- /dev/null
+# ignore Makefiles; they're all automatically generated
+Makefile
--- /dev/null
+# 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