blob: 8c553ebf8d922d40d1a1a6e152146b63242e9d4e [file] [log] [blame]
Alexandre Lision7c6f4a62013-09-05 13:27:01 -04001#!/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
7EXEEXT =
8
9PACKAGE_VERSION = 1.0.25
10
11HOST_TRIPLET = x86_64-unknown-linux-gnu
12
13LIB_VERSION := $(shell echo $(PACKAGE_VERSION) | sed -e 's/[a-z].*//')
14
15TESTNAME = libsndfile-testsuite-$(HOST_TRIPLET)-$(PACKAGE_VERSION)
16
17TARBALL = $(TESTNAME).tar.gz
18
19# Find the test programs by grepping the script for the programs it executes.
20testprogs := $(shell grep '^\./' tests/test_wrapper.sh | sed -e "s|./||" -e "s/ .*//" | sort | uniq)
21# Also add the programs not found by the above.
22testprogs += sfversion stdin_test stdout_test cpp_test win32_test
23
24# Find the single test program in src/ .
25srcprogs := $(shell if test -x src/.libs/test_main$(EXEEXT) ; then echo "src/.libs/test_main$(EXEEXT)" ; else echo "src/test_main$(EXEEXT)" ; fi)
26
27libfiles := $(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
29files := $(addprefix tests/.libs/,$(subst ,$(EXEEXT),$(testprogs))) $(libfiles) $(srcprogs)
30
31
32all : $(TARBALL)
33
34clean :
35 rm -rf $(TARBALL) $(TESTNAME)/
36
37check : $(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
55tests/test_wrapper.sh : tests/test_wrapper.sh.in
56 (cd tests/ ; make $@)