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