Chris@0: #!/usr/bin/make -f Chris@0: Chris@0: # This is probably only going to work with GNU Make. Chris@0: # This in a separate file instead of in Makefile.am because Automake complains Chris@0: # about the GNU Make-isms. Chris@0: Chris@0: EXEEXT = @EXEEXT@ Chris@0: Chris@0: PACKAGE_VERSION = @PACKAGE_VERSION@ Chris@0: Chris@0: HOST_TRIPLET = @HOST_TRIPLET@ Chris@0: Chris@0: LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//') Chris@0: Chris@0: TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION) Chris@0: Chris@0: TARBALL = $(TESTNAME).tar.gz Chris@0: Chris@0: # Find the test programs by grepping the script for the programs it executes. Chris@0: testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq) Chris@0: # Also add the programs not found by the above. Chris@0: testprogs += sfversion@EXEEXT@ stdin_test@EXEEXT@ stdout_test@EXEEXT@ cpp_test@EXEEXT@ win32_test@EXEEXT@ Chris@0: Chris@0: # Find the single test program in src/ . Chris@0: srcprogs := $(shell if test -x src/.libs/test_main$(EXEEXT) ; then echo "src/.libs/test_main$(EXEEXT)" ; else echo "src/test_main$(EXEEXT)" ; fi) Chris@0: Chris@0: 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) Chris@0: Chris@0: files := $(addprefix tests/.libs/,$(subst @EXEEXT@,$(EXEEXT),$(testprogs))) $(libfiles) $(srcprogs) Chris@0: Chris@0: Chris@0: all : $(TARBALL) Chris@0: Chris@0: clean : Chris@0: rm -rf $(TARBALL) $(TESTNAME)/ Chris@0: Chris@0: check : $(TESTNAME)/test_wrapper.sh Chris@0: (cd ./$(TESTNAME)/ && ./test_wrapper.sh) Chris@0: Chris@0: $(TARBALL) : $(TESTNAME)/test_wrapper.sh Chris@0: tar zcf $@ $(TESTNAME) Chris@0: rm -rf $(TESTNAME) Chris@0: @echo Chris@0: @echo "Created : $(TARBALL)" Chris@0: @echo Chris@0: Chris@0: $(TESTNAME)/test_wrapper.sh : $(files) tests/test_wrapper.sh tests/pedantic-header-test.sh Chris@0: rm -rf $(TESTNAME) Chris@0: mkdir -p $(TESTNAME)/tests/ Chris@0: cp $(files) $(TESTNAME)/tests/ Chris@0: cp tests/test_wrapper.sh $(TESTNAME)/ Chris@0: cp tests/pedantic-header-test.sh $(TESTNAME)/tests/ Chris@0: chmod u+x $@ Chris@0: Chris@0: tests/test_wrapper.sh : tests/test_wrapper.sh.in Chris@0: (cd tests/ ; make $@)