build-test-tarball.mk.in 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/make -f
  2. # This is probably only going to work with GNU Make.
  3. # This in a separate file instead of in Makefile.am because Automake complains
  4. # about the GNU Make-isms.
  5. EXEEXT = @EXEEXT@
  6. PACKAGE_VERSION = @PACKAGE_VERSION@
  7. HOST_TRIPLET = @HOST_TRIPLET@
  8. SRC_BINDIR = @SRC_BINDIR@
  9. TEST_BINDIR = @TEST_BINDIR@
  10. LIBRARY := $(SRC_BINDIR)libsndfile.so.$(LIB_VERSION)
  11. LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//')
  12. TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION)
  13. TARBALL = $(TESTNAME).tar.gz
  14. # Find the test programs by grepping the script for the programs it executes.
  15. testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq)
  16. # Also add the programs not found by the above.
  17. testprogs += tests/sfversion$(EXEEXT) tests/stdin_test$(EXEEXT) tests/stdout_test$(EXEEXT) \
  18. tests/cpp_test$(EXEEXT) tests/win32_test$(EXEEXT)
  19. 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)
  20. testbins := $(testprogs) $(libfiles)
  21. all : $(TARBALL)
  22. clean :
  23. rm -rf $(TARBALL) $(TESTNAME)/
  24. check : $(TESTNAME)/test_wrapper.sh
  25. (cd ./$(TESTNAME)/ && ./test_wrapper.sh)
  26. $(TARBALL) : $(TESTNAME)/test_wrapper.sh
  27. tar zcf $@ $(TESTNAME)
  28. rm -rf $(TESTNAME)
  29. @echo
  30. @echo "Created : $(TARBALL)"
  31. @echo
  32. $(TESTNAME)/test_wrapper.sh : tests/test_wrapper.sh tests/pedantic-header-test.sh
  33. rm -rf $(TESTNAME)
  34. mkdir -p $(TESTNAME)/tests/
  35. echo
  36. echo $(testbins)
  37. echo
  38. cp $(testbins) $(TESTNAME)/tests/
  39. cp tests/test_wrapper.sh $(TESTNAME)/
  40. cp tests/pedantic-header-test.sh $(TESTNAME)/tests/
  41. chmod u+x $@
  42. tests/test_wrapper.sh : tests/test_wrapper.sh.in
  43. make $@