From: Akim Demaille Date: Mon, 29 Jan 2001 09:41:41 +0000 (+0000) Subject: * automake.in (handle_phony): Sort. X-Git-Tag: Release-1-4d~78 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=49933a93d6423dbc6ecf7f8da24b2406fabbd1eb;p=automake.git * automake.in (handle_phony): Sort. (file_contents_with_transform): Catch `.PHONY:'. (handle_tests): Instead dumping the hard coded target check-TESTS and registering its .PHONYsm, get them from... * check.am: here, new file. --- diff --git a/ChangeLog b/ChangeLog index 946cd9ee..41cf6a74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-01-29 Akim Demaille + + * automake.in (handle_phony): Sort. + (file_contents_with_transform): Catch `.PHONY:'. + (handle_tests): Instead dumping the hard coded target check-TESTS + and registering its .PHONYsm, get them from... + * check.am: here, new file. + 2001-01-29 Akim Demaille * automake.in (add_depend2): Use &transform. diff --git a/Makefile.am b/Makefile.am index 15e84672..d5774855 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,14 +10,14 @@ SUBDIRS = . m4 tests bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi -amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ -data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ -dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ -kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ -lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am python.am \ -python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ +compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ +dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ +java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ +lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ +python.am python-clean.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ $(amfiles) diff --git a/Makefile.in b/Makefile.in index 9b110d30..c197541c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -77,14 +77,14 @@ SUBDIRS = . m4 tests bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi -amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ -data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ -dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ -kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ -lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am python.am \ -python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ +compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ +dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ +java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ +lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ +python.am python-clean.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ @@ -602,24 +602,25 @@ maintainer-clean-am: maintainer-clean-vti maintainer-clean-aminfo \ maintainer-clean: maintainer-clean-recursive -rm -f config.status -.PHONY: uninstall-binSCRIPTS install-binSCRIPTS mostlyclean-vti \ -distclean-vti clean-vti maintainer-clean-vti install-info-am \ -uninstall-info mostlyclean-aminfo distclean-aminfo clean-aminfo \ -maintainer-clean-aminfo uninstall-dist_pkgdataDATA \ -install-dist_pkgdataDATA uninstall-dist_scriptDATA \ -install-dist_scriptDATA install-recursive uninstall-recursive \ -install-data-recursive uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-local installcheck-am \ -installcheck install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -install-strip installdirs-am installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +.PHONY: all all-am all-recursive all-redirect check check-am \ +check-recursive clean clean-aminfo clean-generic clean-recursive \ +clean-tags clean-vti distclean distclean-aminfo distclean-generic \ +distclean-recursive distclean-tags distclean-vti distdir dvi dvi-am \ +dvi-recursive info info-am info-recursive install install-am \ +install-binSCRIPTS install-data install-data-am install-data-recursive \ +install-dist_pkgdataDATA install-dist_scriptDATA install-exec \ +install-exec-am install-exec-recursive install-info-am \ +install-recursive install-strip installcheck installcheck-am \ +installcheck-local installcheck-recursive installdirs installdirs-am \ +installdirs-recursive maintainer-clean maintainer-clean-aminfo \ +maintainer-clean-generic maintainer-clean-recursive \ +maintainer-clean-tags maintainer-clean-vti mostlyclean \ +mostlyclean-aminfo mostlyclean-generic mostlyclean-recursive \ +mostlyclean-tags mostlyclean-vti tags tags-recursive uninstall \ +uninstall-am uninstall-binSCRIPTS uninstall-data-recursive \ +uninstall-dist_pkgdataDATA uninstall-dist_scriptDATA \ +uninstall-exec-recursive uninstall-info uninstall-recursive \ +uninstalldirs-recursive install-data-hook: diff --git a/automake.in b/automake.in index 732481e5..75b22aca 100755 --- a/automake.in +++ b/automake.in @@ -4057,7 +4057,7 @@ sub do_one_clean_target # Handle .PHONY target. sub handle_phony { - &pretty_print_rule ('.PHONY:', "", @phony); + &pretty_print_rule ('.PHONY:', "", sort @phony); $output_rules .= "\n"; } @@ -4146,65 +4146,10 @@ sub handle_tests if (&variable_defined ('TESTS')) { push (@check_tests, 'check-TESTS'); - push (@phony, 'check-TESTS'); # Note: Solaris 2.7 seems to expand TESTS using VPATH. That's # why we also try `dir=' - $output_rules .= 'check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; \\ - srcdir=$(srcdir); export srcdir; \\ - list=' . "'\$(TESTS)'; \\" . ' - if test -n "$$list"; then \\ - for tst in $$list; do \\ - if test -f ./$$tst; then dir=./; \\ - elif test -f $$tst; then dir=; \\ - else dir="$(srcdir)/"; fi; \\ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \\ - all=`expr $$all + 1`; \\ - case " $(XFAIL_TESTS) " in \\ - *" $$tst "*) \\ - xpass=`expr $$xpass + 1`; \\ - failed=`expr $$failed + 1`; \\ - echo "XPASS: $$tst"; \\ - ;; \\ - *) \\ - echo "PASS: $$tst"; \\ - ;; \\ - esac; \\ - elif test $$? -ne 77; then \\ - all=`expr $$all + 1`; \\ - case " $(XFAIL_TESTS) " in \\ - *" $$tst "*) \\ - xfail=`expr $$xfail + 1`; \\ - echo "XFAIL: $$tst"; \\ - ;; \\ - *) \\ - failed=`expr $$failed + 1`; \\ - echo "FAIL: $$tst"; \\ - ;; \\ - esac; \\ - fi; \\ - done; \\ - if test "$$failed" -eq 0; then \\ - if test "$$xfail" -eq 0; then \\ - banner="All $$all tests passed"; \\ - else \\ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \\ - fi; \\ - else \\ - if test "$$xpass" -eq 0; then \\ - banner="$$failed of $$all tests failed"; \\ - else \\ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \\ - fi; \\ - fi; \\ - dashes=`echo "$$banner" | sed s/./=/g`; \\ - echo "$$dashes"; \\ - echo "$$banner"; \\ - echo "$$dashes"; \\ - test "$$failed" -eq 0; \\ - fi -'; + $output_rules .= &file_contents ('check'); } } @@ -6968,6 +6913,10 @@ sub initialize_per_input ################################################################ + +# $CONTENTS +# &file_contents_with_transform ($COMMAND, $BASENAME) +# --------------------------------------------------- # Return contents of a file from $am_dir, automatically skipping # macros or rules which are already known. Runs command on each line # as it is read; this command can modify $_. @@ -7038,6 +6987,12 @@ sub file_contents_with_transform } $saw_bk = /\\$/; } + elsif (/^.PHONY: (.*)$/) + { + # Having a special case for PHONY upstream seems much easier than + # trying to have it fit in RULE_PATTERN and extract it later. + push (@phony, split (/\s+/, $1)); + } elsif (/$RULE_PATTERN/o) { # Found a rule. diff --git a/check.am b/check.am new file mode 100644 index 00000000..efe60540 --- /dev/null +++ b/check.am @@ -0,0 +1,76 @@ +## automake - create Makefile.in from Makefile.am +## Copyright 2001 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +.PHONY: check-TESTS + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ +## Note: Solaris 2.7 seems to expand TESTS using VPATH. That's +## why we also try `dir=' + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 15e84672..d5774855 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -10,14 +10,14 @@ SUBDIRS = . m4 tests bin_SCRIPTS = automake aclocal info_TEXINFOS = automake.texi -amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ -data-clean.am data.am dejagnu.am depend.am depend2.am dist.am \ -dist-vars.am footer.am header-vars.am header.am java-clean.am java.am \ -kr-extra.am library.am libs-clean.am libs.am libtool.am lisp-clean.am \ -lisp.am ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am \ -multilib.am program.am progs-clean.am progs.am python.am \ -python-clean.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \ +compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \ +dist.am dist-vars.am footer.am header-vars.am header.am java-clean.am \ +java.am kr-extra.am library.am libs-clean.am libs.am libtool.am \ +lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \ +mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \ +python.am python-clean.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ $(amfiles) diff --git a/lib/am/check.am b/lib/am/check.am new file mode 100644 index 00000000..efe60540 --- /dev/null +++ b/lib/am/check.am @@ -0,0 +1,76 @@ +## automake - create Makefile.in from Makefile.am +## Copyright 2001 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +.PHONY: check-TESTS + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ +## Note: Solaris 2.7 seems to expand TESTS using VPATH. That's +## why we also try `dir=' + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi diff --git a/m4/Makefile.in b/m4/Makefile.in index 22efe7c0..b85960fa 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -192,12 +192,12 @@ maintainer-clean-am: maintainer-clean-generic distclean-am maintainer-clean: maintainer-clean-am -.PHONY: uninstall-m4dataDATA install-m4dataDATA tags distdir info-am \ -info dvi-am dvi check check-am installcheck-am installcheck \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +.PHONY: all all-am all-redirect check check-am clean clean-generic \ +distclean distclean-generic distdir dvi dvi-am info info-am install \ +install-am install-data install-data-am install-exec install-exec-am \ +install-m4dataDATA install-strip installcheck installcheck-am \ +installdirs maintainer-clean maintainer-clean-generic mostlyclean \ +mostlyclean-generic tags uninstall uninstall-am uninstall-m4dataDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/tests/ChangeLog b/tests/ChangeLog index 58f3b32d..fb5f672d 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2001-01-29 Akim Demaille + + * check.test: New. + 2001-01-28 Tom Tromey * listval.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 5d2d975f..c23c3f6d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,6 +33,7 @@ canon2.test \ canon3.test \ canon4.test \ canon5.test \ +check.test \ checkall.test \ clean.test \ colneq.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index bd7d1cb7..9d7b3bd4 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -102,6 +102,7 @@ canon2.test \ canon3.test \ canon4.test \ canon5.test \ +check.test \ checkall.test \ clean.test \ colneq.test \ @@ -361,6 +362,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status tags: TAGS TAGS: + check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; \ srcdir=$(srcdir); export srcdir; \ @@ -485,12 +487,12 @@ maintainer-clean-am: maintainer-clean-generic distclean-am maintainer-clean: maintainer-clean-am -.PHONY: tags check-TESTS distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +.PHONY: all all-am all-redirect check check-TESTS check-am clean \ +clean-generic distclean distclean-generic distdir dvi dvi-am info \ +info-am install install-am install-data install-data-am install-exec \ +install-exec-am install-strip installcheck installcheck-am installdirs \ +maintainer-clean maintainer-clean-generic mostlyclean \ +mostlyclean-generic tags uninstall uninstall-am distclean-local: diff --git a/tests/check.test b/tests/check.test new file mode 100755 index 00000000..2cf75083 --- /dev/null +++ b/tests/check.test @@ -0,0 +1,21 @@ +#! /bin/sh + +# Test Automake style tests. + +. $srcdir/defs || exit 1 + +cat > Makefile.am << 'END' +TESTS = frob.test +END + +: > frob.test + +$AUTOMAKE || exit 1 + +grep '^check-TESTS:' Makefile.in || exit 1 +grep '^check-DEJAGNU' Makefile.in && exit 1 + +# check-TESTS is phony. +sed -n '/^\.PHONY:/,/^$/p' Makefile.in | grep check-TESTS || exit 1 + +exit 0