| 1 | ### -*-makefile-*- |
| 2 | ### |
| 3 | ### Build script for test framework |
| 4 | ### |
| 5 | ### (c) 2008 Straylight/Edgeware |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This file is part of the Common Files Distribution (`common'). |
| 11 | ### |
| 12 | ### `Common' is free software; you can redistribute it and/or modify |
| 13 | ### it under the terms of the GNU General Public License as published by |
| 14 | ### the Free Software Foundation; either version 2 of the License, or |
| 15 | ### (at your option) any later version. |
| 16 | ### |
| 17 | ### `Common' is distributed in the hope that it will be useful, |
| 18 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | ### GNU General Public License for more details. |
| 21 | ### |
| 22 | ### You should have received a copy of the GNU General Public License |
| 23 | ### along with `common'; if not, write to the Free Software Foundation, |
| 24 | ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | |
| 26 | EXTRA_DIST = |
| 27 | CLEANFILES = |
| 28 | DISTCLEANFILES = |
| 29 | MAINTAINERCLEANFILES = |
| 30 | |
| 31 | ###-------------------------------------------------------------------------- |
| 32 | ### The test suite. |
| 33 | |
| 34 | check-local: atconfig run-tests |
| 35 | ./run-tests $(TEST_ARGS) |
| 36 | |
| 37 | ###-------------------------------------------------------------------------- |
| 38 | ### Building the test suite. |
| 39 | |
| 40 | ## testsuite |
| 41 | all_autotest_TESTS = $(autotest_TESTS) $(nodist_autotest_TESTS) |
| 42 | TESTDEPS = testsuite.at Makefile.in $(all_autotest_TESTS) |
| 43 | CLEANFILES += testsuite.log |
| 44 | DISTCLEANFILES += atconfig |
| 45 | MAINTAINERCLEANFILES += $(srcdir)/testsuite |
| 46 | EXTRA_DIST += testsuite.at testsuite $(autotest_TESTS) |
| 47 | |
| 48 | $(srcdir)/testsuite: $(TESTDEPS) |
| 49 | $(AM_V_GEN)$(AUTOM4TE) --language=autotest \ |
| 50 | -I$(srcdir) $@.at -o $@.new && mv $@.new $@ |
| 51 | |
| 52 | clean-local: clean-testsuite-dir |
| 53 | .PHONY: clean-testsuite-dir |
| 54 | clean-testsuite-dir: |
| 55 | -rm -rf testsuite.dir |
| 56 | |
| 57 | ## run-tests |
| 58 | CLEANFILES += run-tests |
| 59 | |
| 60 | run-tests: Makefile $(srcdir)/testsuite |
| 61 | $(AM_V_GEN) \ |
| 62 | { echo '#! /bin/sh'; \ |
| 63 | echo 'exec $(SHELL) $(srcdir)/testsuite "$$@"'; \ |
| 64 | } >$@.new && chmod +x $@.new && mv $@.new $@ |
| 65 | |
| 66 | ###-------------------------------------------------------------------------- |
| 67 | ### Infrastructure for the test suite build process. |
| 68 | |
| 69 | ## tests.m4 |
| 70 | TESTDEPS += $(srcdir)/tests.m4 |
| 71 | MAINTAINERCLEANFILES += $(srcdir)/tests.m4 |
| 72 | EXTRA_DIST += tests.m4 |
| 73 | |
| 74 | $(srcdir)/tests.m4: Makefile.in |
| 75 | $(AM_V_GEN) \ |
| 76 | for i in $(all_autotest_TESTS); do \ |
| 77 | echo $$i | sed \ |
| 78 | -e 's:^$(top_srcdir):$(top_builddir):' \ |
| 79 | -e 's:\(.*\)/\([^/]*\)$$:TESTS([\1], [\2]):'; \ |
| 80 | done >$@.new && mv $@.new $@ |
| 81 | |
| 82 | ## package.m4 |
| 83 | TESTDEPS += $(srcdir)/package.m4 |
| 84 | MAINTAINERCLEANFILES += $(srcdir)/package.m4 |
| 85 | EXTRA_DIST += package.m4 |
| 86 | |
| 87 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac |
| 88 | $(AM_V_GEN) \ |
| 89 | { echo '### package information'; \ |
| 90 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ |
| 91 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ |
| 92 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ |
| 93 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ |
| 94 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ |
| 95 | } >$@.new && mv $@.new $@ |
| 96 | |
| 97 | ###----- That's all, folks -------------------------------------------------- |