summaryrefslogtreecommitdiff
path: root/build-test-tarball.mk.in
diff options
context:
space:
mode:
authorLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:35:05 +0100
committerLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:35:05 +0100
commitaceb1f30497619786f1827e4c65992b890a07410 (patch)
treece33ac9d0d076a8ec4f993e614cf71a4d5daa7e7 /build-test-tarball.mk.in
downloadlibsndfile-aceb1f30497619786f1827e4c65992b890a07410.tar.gz
Tarball conversion
Diffstat (limited to 'build-test-tarball.mk.in')
-rw-r--r--build-test-tarball.mk.in56
1 files changed, 56 insertions, 0 deletions
diff --git a/build-test-tarball.mk.in b/build-test-tarball.mk.in
new file mode 100644
index 0000000..b6f2f23
--- /dev/null
+++ b/build-test-tarball.mk.in
@@ -0,0 +1,56 @@
+#!/usr/bin/make -f
+
+# This is probably only going to work with GNU Make.
+# This in a separate file instead of in Makefile.am because Automake complains
+# about the GNU Make-isms.
+
+EXEEXT = @EXEEXT@
+
+PACKAGE_VERSION = @PACKAGE_VERSION@
+
+HOST_TRIPLET = @HOST_TRIPLET@
+
+LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//')
+
+TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION)
+
+TARBALL = $(TESTNAME).tar.gz
+
+# Find the test programs by grepping the script for the programs it executes.
+testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq)
+# Also add the programs not found by the above.
+testprogs += sfversion@EXEEXT@ stdin_test@EXEEXT@ stdout_test@EXEEXT@ cpp_test@EXEEXT@ win32_test@EXEEXT@
+
+# Find the single test program in src/ .
+srcprogs := $(shell if test -x src/.libs/test_main$(EXEEXT) ; then echo "src/.libs/test_main$(EXEEXT)" ; else echo "src/test_main$(EXEEXT)" ; fi)
+
+libfiles := $(shell if test ! -z $(EXEEXT) ; then echo "src/libsndfile-1.def src/.libs/libsndfile-1.dll" ; else echo "src/.libs/libsndfile.so.$(LIB_VERSION)" ; fi)
+
+files := $(addprefix tests/.libs/,$(subst @EXEEXT@,$(EXEEXT),$(testprogs))) $(libfiles) $(srcprogs)
+
+
+all : $(TARBALL)
+
+clean :
+ rm -rf $(TARBALL) $(TESTNAME)/
+
+check : $(TESTNAME)/test_wrapper.sh
+ (cd ./$(TESTNAME)/ && ./test_wrapper.sh)
+
+$(TARBALL) : $(TESTNAME)/test_wrapper.sh
+ tar zcf $@ $(TESTNAME)
+ rm -rf $(TESTNAME)
+ @echo
+ @echo "Created : $(TARBALL)"
+ @echo
+
+$(TESTNAME)/test_wrapper.sh : $(files) tests/test_wrapper.sh tests/pedantic-header-test.sh
+ rm -rf $(TESTNAME)
+ mkdir -p $(TESTNAME)/tests/
+ cp $(files) $(TESTNAME)/tests/
+ cp tests/test_wrapper.sh $(TESTNAME)/
+ cp tests/pedantic-header-test.sh $(TESTNAME)/tests/
+ chmod u+x $@
+
+tests/test_wrapper.sh : tests/test_wrapper.sh.in
+ (cd tests/ ; make $@)