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