Alexandre Lision | 7c6f4a6 | 2013-09-05 13:27:01 -0400 | [diff] [blame] | 1 | #!/usr/bin/make -f |
| 2 | |
| 3 | # This is probably only going to work with GNU Make. |
| 4 | # This in a separate file instead of in Makefile.am because Automake complains |
| 5 | # about the GNU Make-isms. |
| 6 | |
| 7 | EXEEXT = |
| 8 | |
| 9 | PACKAGE_VERSION = 1.0.25 |
| 10 | |
| 11 | HOST_TRIPLET = x86_64-unknown-linux-gnu |
| 12 | |
| 13 | LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//') |
| 14 | |
| 15 | TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION) |
| 16 | |
| 17 | TARBALL = $(TESTNAME).tar.gz |
| 18 | |
| 19 | # Find the test programs by grepping the script for the programs it executes. |
| 20 | testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq) |
| 21 | # Also add the programs not found by the above. |
| 22 | testprogs += sfversion stdin_test stdout_test cpp_test win32_test |
| 23 | |
| 24 | # Find the single test program in src/ . |
| 25 | srcprogs := $(shell if test -x src/.libs/test_main$(EXEEXT) ; then echo "src/.libs/test_main$(EXEEXT)" ; else echo "src/test_main$(EXEEXT)" ; fi) |
| 26 | |
| 27 | 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) |
| 28 | |
| 29 | files := $(addprefix tests/.libs/,$(subst ,$(EXEEXT),$(testprogs))) $(libfiles) $(srcprogs) |
| 30 | |
| 31 | |
| 32 | all : $(TARBALL) |
| 33 | |
| 34 | clean : |
| 35 | rm -rf $(TARBALL) $(TESTNAME)/ |
| 36 | |
| 37 | check : $(TESTNAME)/test_wrapper.sh |
| 38 | (cd ./$(TESTNAME)/ && ./test_wrapper.sh) |
| 39 | |
| 40 | $(TARBALL) : $(TESTNAME)/test_wrapper.sh |
| 41 | tar zcf $@ $(TESTNAME) |
| 42 | rm -rf $(TESTNAME) |
| 43 | @echo |
| 44 | @echo "Created : $(TARBALL)" |
| 45 | @echo |
| 46 | |
| 47 | $(TESTNAME)/test_wrapper.sh : $(files) tests/test_wrapper.sh tests/pedantic-header-test.sh |
| 48 | rm -rf $(TESTNAME) |
| 49 | mkdir -p $(TESTNAME)/tests/ |
| 50 | cp $(files) $(TESTNAME)/tests/ |
| 51 | cp tests/test_wrapper.sh $(TESTNAME)/ |
| 52 | cp tests/pedantic-header-test.sh $(TESTNAME)/tests/ |
| 53 | chmod u+x $@ |
| 54 | |
| 55 | tests/test_wrapper.sh : tests/test_wrapper.sh.in |
| 56 | (cd tests/ ; make $@) |