automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {master} Improve and extend tests `suffix*.test'.


From: Stefano Lattarini
Subject: [PATCH] {master} Improve and extend tests `suffix*.test'.
Date: Thu, 16 Dec 2010 19:14:43 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hello automakers.

Here it is one of the last (5 or 6) testsuite-only patches I have in
my repository.

Tested successfully:

  - Debian GNU/Linux, system GNU make (3.81) & bash (4.1), gcc 4.4.4,
    libtool 2.2.6b, autoconf 2.68.

  - Debian GNU/Linux, GNU make 3.79, dash (0.5.5.1), gcc 4.0.1,
    libtool 2.2.6b, autoconf 2.68

  - Debian GNU/Linux, GNU make 3.82, dash (0.5.2), gcc 2.95,
    libtool 2.2.6b, autoconf 2.68

  - Debian GNU/Linux, GNU make 3.80, pdksh (5.2.14), gcc 3.3,
    libtool libtool 1.5.6, autoconf 2.65

  - Debian GNU/Linux, GNU make 3.78.1, ksh (Version JM 93t+ 2009-05-01),
    SunStudio C compiler (Sun C 5.10 Linux_i386 2009/06/03),
    libtool 2.2.2, autoconf 2.62

  - Debian GNU/Linux, FreeBSD make (from freebsd-buildutils 8.0),
    bash 2.05, gcc 3.4, libtool 2.2.2, autoconf 2.62

  - Debian GNU/Linux, NetBSD make (from pmake-1.111 [sic]), bash 3.0,
    SunStudio C compiler (Sun C 5.10 Linux_i386 2009/06/03),
    libtool 2.2.8, autoconf 2.63

  - Solaris 10, GNU make 3.82, Solaris /bin/sh, libtool 2.4, autoconf 2.68
    SunStudio C compiler (Sun C 5.9 SunOS_i386 Patch 124868-15 2010/08/11),
    some GNU tools (sed, expr, awk) available

Tested with some errors:

  - Solaris 10, CCS make, Solaris /bin/ksh, libtool 2.4, autoconf 2.68,
    SunStudio C compiler (Sun C 5.9 SunOS_i386 Patch 124868-15 2010/08/11)
    only Solaris utilities available

  - Solaris 10, XPG4 make, Solaris /bin/sh, libtool 2.4, autoconf 2.68,
    gcc 4.4.4, only Solaris utilities available

  - Solaris 10, dmake, Solaris /bin/sh, libtool 2.4, autoconf 2.68,
    gcc 4.4.4, some GNU tools (sed, expr, awk) available

  - Debian GNU/Linux, Heirloom make and shell (2007), gcc 4.2.4,
    libtool 2.2.8, autoconf 2.67, and with Heirloom utilities (sed,
    grep, etc.) preferred over system (GNU) utilities

In all the setups indicated as "with some errors" above, the tests
`suffix3.test', `suffix8.test', `suffix10.test' and `suffix11.test'
failed due to the inability of those make implementations to chain
implicit rules.

I would have worked around those failures by either declaring hidden
dependencies explicitly in the Makefile.am files, or by skipping the
affected tests if the make implementation is found unable to chain
implicit dependencies.  But since there's no consensus on this yet,
I'd rather leave the tests fail FTM.  They can be adjusted in a
follow-up patch anyway (or better, Automake could be improved to
work around the limitations of those make implementations).

OK to apply to a temporary branch off of maint, and merge to master?
I will push in 72 hours (Sunday evening) if there is no objection
or review by then.

Regards,
   Stefano
From 497eb149e4b470f00afe477ce8b5e2da63c61252 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 15 Oct 2010 17:37:38 +0200
Subject: [PATCH] Improve and extend tests `suffix*.test'.

* tests/suffix.test: Check that suffix rules for C compilation are
only included once.  Try also with a static library.
* tests/suffix2.test: Add a new grep to help potential debugging.
Do not run automake with the `--add-missing' options, since we
already create all the needed auxiliary files.  Try also *without*
the `no-dependencies' automake option.
* tests/suffix4.test: Make grepping of Makefile.in stricter.
* tests/suffix3.test: Rewritten to run also autoconf, ./configure
and make.
* tests/suffix5.test: Likewise.
* tests/suffix6.test: Fix botched recipe indentation (eight spaces
were used instead of a tabulation character).  Extend to check
that `.obj' is handled like `.$(OBJEXT)' (as is done for `.o').
Improved parsing & grepping of generated Makefile.in.  Other minor
fixes and improvements.
* tests/suffix10.test: Move some checks in Makefile.am.  Also run
"make all".
* tests/suffix12.test: Likewise, and account for VPATH issues in
weaker make implementations.
* tests/suffix11.test: Likewise.  Also, run "make distcheck", for
completeness, and related changes.
* tests/suffix8.test: Likewise.  Also, do not put `gcc' anymore
in $required.
* tests/suffix13.test: Do not use the `--force-missing' automake
option unnecessarily.
* tests/suffix6b.test: New test, semantic sister of `suffix6.test'.
* tests/suffix6c.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog           |   32 ++++++++++++++++++
 tests/Makefile.am   |    2 +
 tests/Makefile.in   |    2 +
 tests/suffix.test   |   14 ++++++--
 tests/suffix10.test |   31 ++++++++++++-----
 tests/suffix11.test |   37 +++++++++++++-------
 tests/suffix12.test |   18 ++++++----
 tests/suffix13.test |    2 +-
 tests/suffix2.test  |   13 +++++--
 tests/suffix3.test  |   37 +++++++++++++++++++--
 tests/suffix4.test  |    4 ++-
 tests/suffix5.test  |   24 +++++++++++--
 tests/suffix6.test  |   37 +++++++++++++++-----
 tests/suffix6b.test |   77 ++++++++++++++++++++++++++++++++++++++++++
 tests/suffix6c.test |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/suffix8.test  |   67 ++++++++++++++++++++----------------
 16 files changed, 407 insertions(+), 82 deletions(-)
 create mode 100755 tests/suffix6b.test
 create mode 100755 tests/suffix6c.test

diff --git a/ChangeLog b/ChangeLog
index 2482ef1..51171f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2010-12-16  Stefano Lattarini  <address@hidden>
+
+       Improve and extend tests `suffix*.test'.
+       * tests/suffix.test: Check that suffix rules for C compilation are
+       only included once.  Try also with a static library.
+       * tests/suffix2.test: Add a new grep to help potential debugging.
+       Do not run automake with the `--add-missing' options, since we
+       already create all the needed auxiliary files.  Try also *without*
+       the `no-dependencies' automake option.
+       * tests/suffix4.test: Make grepping of Makefile.in stricter.
+       * tests/suffix3.test: Rewritten to run also autoconf, ./configure
+       and make.
+       * tests/suffix5.test: Likewise.
+       * tests/suffix6.test: Fix botched recipe indentation (eight spaces
+       were used instead of a tabulation character).  Extend to check
+       that `.obj' is handled like `.$(OBJEXT)' (as is done for `.o').
+       Improved parsing & grepping of generated Makefile.in.  Other minor
+       fixes and improvements.
+       * tests/suffix10.test: Move some checks in Makefile.am.  Also run
+       "make all".
+       * tests/suffix12.test: Likewise, and account for VPATH issues in
+       weaker make implementations.
+       * tests/suffix11.test: Likewise.  Also, run "make distcheck", for
+       completeness, and related changes.
+       * tests/suffix8.test: Likewise.  Also, do not put `gcc' anymore
+       in $required.
+       * tests/suffix13.test: Do not use the `--force-missing' automake
+       option unnecessarily.
+       * tests/suffix6b.test: New test, semantic sister of `suffix6.test'.
+       * tests/suffix6c.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-12-14  Stefano Lattarini  <address@hidden>
 
        Improve tests on generated portions of configure help screen.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..78186d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -710,6 +710,8 @@ suffix3.test \
 suffix4.test \
 suffix5.test \
 suffix6.test \
+suffix6b.test \
+suffix6c.test \
 suffix7.test \
 suffix8.test \
 suffix9.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..fa0d9f5 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -977,6 +977,8 @@ suffix3.test \
 suffix4.test \
 suffix5.test \
 suffix6.test \
+suffix6b.test \
+suffix6c.test \
 suffix7.test \
 suffix8.test \
 suffix9.test \
diff --git a/tests/suffix.test b/tests/suffix.test
index c790c66..4e81366 100755
--- a/tests/suffix.test
+++ b/tests/suffix.test
@@ -14,7 +14,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure a suffix rule for C compilation is produced.
+# Make sure proper suffix rules for C compilation are produced, and
+# only once.
+# See also related test `suffix2.test'.
 
 . ./defs || Exit 1
 
@@ -22,18 +24,24 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AC_PROG_RANLIB
 END
 
 cat > Makefile.am << 'END'
 noinst_PROGRAMS = foo
+noinst_LIBRARIES = libbar.a
 END
 
 $ACLOCAL
 
 $AUTOMAKE -i
-grep '^\.c\.o' Makefile.in
+grep '^ *\.c' Makefile.in # for debugging
+test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
 $AUTOMAKE
-grep '^\.c\.o' Makefile.in
+grep '^ *\.c' Makefile.in # for debugging
+test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
 :
diff --git a/tests/suffix10.test b/tests/suffix10.test
index 131359c..0398d89 100755
--- a/tests/suffix10.test
+++ b/tests/suffix10.test
@@ -29,16 +29,31 @@ AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
 
-
 cat >Makefile.am << 'END'
 lib_LTLIBRARIES = libfoo.la
 libfoo_la_SOURCES = foo.x_
-
 .x_.y:
-       cp $< $@
+       rm -f $@ address@hidden
+## the leading `:;' works around a bug in bash <= 3.2
+       :; { echo '/* autogenerated */' \
+         && echo '%{' \
+         && echo 'int yylex () {return 0;}' \
+         && echo 'void yyerror (char *s) {}' \
+         && echo '%}' \
+         && echo '%%' \
+         && echo 'WORD: "foo";' \
+         && echo '%%' \
+## account for VPATH issues on weaker make implementations
+         && cat `test -f $< || echo $(srcdir)/`$<; \
+       } > address@hidden
+       mv -f address@hidden $@
+.PHONY: test
+test:
+       echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$'
+END
 
-print:
-       echo BEGIN: $(libfoo_la_OBJECTS) :END
+cat > foo.x_ << 'END'
+int foo (void) { return yyparse(); }
 END
 
 libtoolize --force
@@ -47,9 +62,7 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 
 ./configure
-
-$MAKE print >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'BEGIN: foo.lo :END' stdout
+$MAKE test
+$MAKE all
 
 :
diff --git a/tests/suffix11.test b/tests/suffix11.test
index 91d2cf4..ec4f5a1 100755
--- a/tests/suffix11.test
+++ b/tests/suffix11.test
@@ -32,18 +32,30 @@ bin_PROGRAMS = foo bar baz
 foo_SOURCES = foo.x_
 bar_SOURCES = bar.y-z
 baz_SOURCES = baz1.x_ baz2.y-z
+
 .y-z.c .x_.c:
-       cp $< $@
-  .z_.c   .w_.x_ :
-       cp $< $@
+## account for VPATH issues on weaker make implementations (e.g. IRIX 6.5)
+       sed 's/INTEGER/int/g' `test -f $< || echo $(srcdir)/`$< >$@
+
+CLEANFILES = foo.c bar.c baz1.c baz2.c
 
-.PHONY: print
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
-       @echo BEGIN: $(bar_OBJECTS) :END
-       @echo BEGIN: $(baz_OBJECTS) :END
+.PHONY: test-real test-fake
+test-fake:
+       echo $(foo_OBJECTS) | grep '^foo\.foo$$'
+       echo $(bar_OBJECTS) | grep '^bar\.foo$$'
+       echo $(baz_OBJECTS) | grep '^baz1\.foo baz2\.foo$$'
+test-real:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
+       echo $(bar_OBJECTS) | grep '^bar\.$(OBJEXT)$$'
+       echo $(baz_OBJECTS) | grep '^baz1\.$(OBJEXT) baz2\.$(OBJEXT)$$'
+check-local: test-real
 END
 
+echo 'INTEGER main(void) { return 0; }' > foo.x_
+echo 'INTEGER main(void) { return 0; }' > bar.y-z
+echo 'INTEGER main(void) { INTEGER baz(void); return baz(); }' > baz1.x_
+echo 'INTEGER baz(void) { return 0; }' > baz2.y-z
+
 $ACLOCAL
 $AUTOCONF
 
@@ -56,10 +68,9 @@ $AUTOMAKE -a -Wno-portability
 
 ./configure
 
-OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.foo :END' stdout
-$FGREP 'BEGIN: bar.foo :END' stdout
-$FGREP 'BEGIN: baz1.foo baz2.foo :END' stdout
+OBJEXT=foo $MAKE -e test-fake
+$MAKE test-real
+$MAKE
+$MAKE distcheck
 
 :
diff --git a/tests/suffix12.test b/tests/suffix12.test
index 21089a5..40f7b3f 100755
--- a/tests/suffix12.test
+++ b/tests/suffix12.test
@@ -31,14 +31,17 @@ AUTOMAKE_OPTIONS = subdir-objects
 SUFFIXES = .baz .o
 # we fake here:
 .baz.o:
-       cp $< $@
+       ## account for VPATH issues on weaker make implementations
+       cp `test -f $< || echo $(srcdir)/`$< $@
 
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c sub/bar.baz
 
-.PHONY: print
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
+.PHONY: test-fake test-real
+test-fake:
+       echo $(foo_OBJECTS) | grep '^foo\.quux sub/bar\.quux$$'
+test-real:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT) sub/bar\.$(OBJEXT)$$'
 END
 
 mkdir sub
@@ -48,9 +51,10 @@ mkdir sub
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
+
 ./configure
-OBJEXT=OBJ $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.OBJ sub/bar.OBJ :END' stdout
+
+OBJEXT=quux $MAKE -e test-fake
+$MAKE test-real
 
 :
diff --git a/tests/suffix13.test b/tests/suffix13.test
index 2b39460..e56d03c 100755
--- a/tests/suffix13.test
+++ b/tests/suffix13.test
@@ -69,7 +69,7 @@ $MAKE distclean
 
 sed '/subdir-objects/d' < Makefile.am > t
 mv -f t Makefile.am
-$AUTOMAKE --force
+$AUTOMAKE
 ./configure
 $MAKE
 $MAKE distcheck
diff --git a/tests/suffix2.test b/tests/suffix2.test
index 405ce90..e2fd663 100755
--- a/tests/suffix2.test
+++ b/tests/suffix2.test
@@ -15,7 +15,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure .c.o rule is only included once.
+# Make sure proper suffix rules for C compilation are produced,
+# and only once, even for libtool libraries.
+# See also related test `suffix.test'.
 required=libtoolize
 
 . ./defs || Exit 1
@@ -28,7 +30,6 @@ AC_PROG_LIBTOOL
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = no-dependencies
 lib_LTLIBRARIES = libltdl.la
 libltdl_la_SOURCES = ltdl.c ltdl.h
 END
@@ -41,8 +42,14 @@ END
 : > config.sub
 
 $ACLOCAL
-$AUTOMAKE -a
 
+$AUTOMAKE -i
+grep '^ *\.c' Makefile.in # for debugging
+test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
+
+$AUTOMAKE
+grep '^ *\.c' Makefile.in # for debugging
 test `grep -c '^\.c\.o:' Makefile.in` -eq 1
 test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
diff --git a/tests/suffix3.test b/tests/suffix3.test
index fc445bf..0ec457e 100755
--- a/tests/suffix3.test
+++ b/tests/suffix3.test
@@ -22,24 +22,55 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CXX
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUFFIXES = .zoo
 .zoo.cc:
-       convert-zoo whatever
+       sed 's/INTEGER/int/g' `test -f $< || echo $(srcdir)/`$< >$@
 bin_PROGRAMS = foo
 foo_SOURCES = foo.zoo
+# This is required by "make distcheck".  The useless indirection is
+# reequired to avoid false positives by the grepping checks below.
+FOO = foo
+CLEANFILES = $(FOO).cc
 END
 
 $ACLOCAL
 $AUTOMAKE
 
 # The foo.cc intermediate step is implicit, it's a mistake if
-# Automake requires this file somewhere.
-$FGREP foo.cc Makefile.in && Exit 1
+# Automake requires this file somewhere.  Also, Automake should
+# not require the file `foo.c' anywhere.
+$FGREP foo.c Makefile.in && Exit 1
 # However Automake must figure that foo.zoo is eventually
 # transformed into foo.o, and use this latter file (to link foo).
 $FGREP 'foo.$(OBJEXT)' Makefile.in
 
+$AUTOCONF
+./configure
+
+# This is deliberately valid C++, but invalid C.
+cat > foo.zoo <<'END'
+#include <iostream>
+using namespace std;
+INTEGER main(void)
+{
+  return 0;
+}
+END
+
+$MAKE
+# FIXME: should we check that intermediate file `foo.cc' has
+# been removed?  Or is this requiring too much from the make
+# implementation?
+
+# Intermediate files should not be distributed.
+$MAKE distdir
+test ! -r $me-1.0/foo.cc
+
+# Check the distribution.
+$MAKE distcheck
+
 :
diff --git a/tests/suffix4.test b/tests/suffix4.test
index e952283..b83c280 100755
--- a/tests/suffix4.test
+++ b/tests/suffix4.test
@@ -34,6 +34,8 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-grep '.SUFFIXES:.*\.k' Makefile.in
+grep '^\.SUFFIXES:' Makefile.in | sed -e 's/$/ /' > suffixes
+cat suffixes
+$FGREP ' .k ' suffixes
 
 :
diff --git a/tests/suffix5.test b/tests/suffix5.test
index b3b36aa..f661620 100755
--- a/tests/suffix5.test
+++ b/tests/suffix5.test
@@ -24,23 +24,41 @@ required=libtool
 set -e
 
 cat >> configure.in << 'END'
+AC_SUBST([LINK], [:])
 AC_PROG_LIBTOOL
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 .k.lo:
-       echo $< > $@
+## account for VPATH issues on weaker make implementations
+       (echo $< && cat `test -f $< || echo $(srcdir)/`$<) > $@
 
 noinst_LTLIBRARIES = libfoo.la
 libfoo_la_SOURCES = foo.k
+
+.PHONY: test
+test: all
+       grep '^=GREP=ME=$$' foo.lo
+## weaker regex to account for VPATH issues
+       grep 'foo\.k$$' foo.lo
+check-local: test
 END
 
 : > ltmain.sh
-: > config.guess
-: > config.sub
+
+cp "$testsrcdir/../lib/config.guess" "$testsrcdir/../lib/config.sub" .
 
 $ACLOCAL
 $AUTOMAKE
 grep '_OBJECTS.*foo\.lo' Makefile.in
 
+$AUTOCONF
+./configure
+
+echo '=GREP=ME=' > foo.k
+
+$MAKE test
+$MAKE distcheck
+
 :
diff --git a/tests/suffix6.test b/tests/suffix6.test
index ab7cf64..7bfabb3 100755
--- a/tests/suffix6.test
+++ b/tests/suffix6.test
@@ -15,32 +15,51 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure Automake supports implicit rules with dot-less
-# extensions.  Also make sure that `.o' is handled like `.$(OBJEXT)'.
+# extensions.  Also make sure that `.o' and `.obj' are handled like
+# `.$(OBJEXT)'.  See also related "semantic" tests suffix6b.test
+# and suffix6c.test.
 
 . ./defs || Exit 1
 
 set -e
 
 cat > Makefile.am << 'END'
-SUFFIXES = a b .$(OBJEXT) c .o
+SUFFIXES = a b .$(OBJEXT) c .o .obj
 bin_PROGRAMS = foo
-foo_SOURCES = fooa fuc
+foo_SOURCES = fooa barc bazc
 ab:
-        cp $< $@
+       dummy action 1
 b.$(OBJEXT):
-       cp $< $@
+       dummy action 2
 c.o:
-       cp $< $@
+       dummy action C
+c.obj:
+       dummy action C
 END
 
 $ACLOCAL
 $AUTOMAKE
 
+sed -n -e '/foo_OBJECTS *=.*\\$/ {
+  :loop
+  p
+  n
+  t clear
+  :clear
+  s/\\$/\\/
+  t loop
+  p
+  n
+}' -e 's/$/ /' -e 's/^.*foo_OBJECTS *= */ /p' Makefile.in > foo-objects
+cat foo-objects
+
 # Automake must figure that fooa translates to foo.$(OBJEXT) and
 # foo.$(OBJEXT) using the following rules:
 #  fooa --[ab]--> foob --[b.$(OBJEXT)]--> foo.$(OBJEXT)
-grep '_OBJECTS.* foo\.\$(OBJEXT)' Makefile.in
-#  fuc --[c.o]--> fu.$(OBJEXT)  ## This is really meant !
-grep '_OBJECTS.* fu\.\$(OBJEXT)' Makefile.in
+$FGREP ' foo.$(OBJEXT) ' foo-objects
+#  barc --[c.o]--> bar.$(OBJEXT)    ## This is really meant !
+$FGREP ' bar.$(OBJEXT) ' foo-objects
+#  bazc --[c.obj]--> baz.$(OBJEXT)  ## This is really meant !
+$FGREP ' baz.$(OBJEXT) ' foo-objects
 
 :
diff --git a/tests/suffix6b.test b/tests/suffix6b.test
new file mode 100755
index 0000000..a96c941
--- /dev/null
+++ b/tests/suffix6b.test
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2010 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, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure Automake supports implicit rules with dot-less
+# extensions.  Se also related "grepping" test suffix6.test.
+
+required=GNUmake # other makes might not grok dot-less suffix rules
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f ...),
+# So we need this hack -- but since such an hack can also serve as a
+# mild stress test, that's ok.
+AC_SUBST([LINK], ['cat >$@'])
+AC_SUBST([OBJEXT], [oOo])
+AC_SUBST([EXEEXT], [.XxX])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUFFIXES = a b c .$(OBJEXT)
+bin_PROGRAMS = foo
+foo_SOURCES = fooa
+ab:
+       { echo '=ab=' && cat $<; } >$@
+bc:
+       { echo '=bc=' && cat $<; } >$@
+c.$(OBJEXT):
+       { echo '=b.obj=' && cat $<; } >$@
+test:
+       : for debugging
+       ls -l
+       : implicit intermediate files should be removed by GNU make
+       test ! -r foob
+       test ! -r fooc
+       : but object files should not
+       cat foo.$(OBJEXT)
+       : for debugging
+       cat foo.XxX
+       : now check that the chain of implicit rules has been executed
+       : completely and in the correct order
+       (echo =b.obj= && echo =bc= && echo =ab= && echo =src=) > exp
+       diff exp foo.XxX
+       rm -f exp
+.PHONY: test
+check-local: test
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+echo =src= > fooa
+
+$MAKE
+$MAKE test
+$MAKE distcheck
+
+:
diff --git a/tests/suffix6c.test b/tests/suffix6c.test
new file mode 100755
index 0000000..e4b84cc
--- /dev/null
+++ b/tests/suffix6c.test
@@ -0,0 +1,92 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2010 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, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure that `.o' and `.obj' are handled like `.$(OBJEXT)'.
+# See also related "grepping" test suffix6.test.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f ...),
+# So we need this hack -- but since such an hack can also serve as a
+# mild stress test, that's ok.
+OBJEXT=${OBJEXT-oOo}
+AC_SUBST([LINK], ['cat >$@'])
+AC_SUBST([EXEEXT], [.XxX])
+AC_SUBST([OBJEXT])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUFFIXES = .zoo .o .obj address@hidden@
+
+bin_PROGRAMS = foo
+foo_SOURCES = foo.zoo
+
+.zoo.o:
+       { echo '=.zoo.o=' && cat $<; } >$@
+.zoo.obj:
+       { echo '=.zoo.obj=' && cat $<; } >$@
address@hidden@:
+       { echo 'address@hidden@=' && cat $<; } >$@
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat > foo.exp <<'END'
+=.zoo.oOo=
+%ONE%
+END
+echo %ONE% > foo.zoo
+$MAKE
+cat foo.oOo
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+cat > foo.exp <<'END'
+=.zoo.o=
+%TWO%
+END
+echo %TWO% > foo.zoo
+OBJEXT=o $MAKE -e
+cat foo.o
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+cat > foo.exp <<'END'
+=.zoo.obj=
+%THREE%
+END
+echo %THREE% > foo.zoo
+OBJEXT=obj $MAKE -e
+cat foo.obj
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+:
diff --git a/tests/suffix8.test b/tests/suffix8.test
index 70ff3a5..8760d7b 100755
--- a/tests/suffix8.test
+++ b/tests/suffix8.test
@@ -14,10 +14,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure Automake supports multiple derivations for the same suffix.
-# PR/37
+# Test to make sure Automake supports multiple derivations for the
+# same suffix.
+# From PR/37.
 
-required='gcc libtoolize'
+required=libtoolize
 . ./defs || Exit 1
 
 set -e
@@ -28,41 +29,48 @@ AC_OUTPUT
 END
 
 cat >Makefile.am << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f ...),
+# So we need this hack.
+LINK = :
+
 bin_PROGRAMS = foo
 lib_LTLIBRARIES = libfoo.la
 
 foo_SOURCES = foo.x_
 libfoo_la_SOURCES = bar.x_
 
+# The elaborate cp commands below account for VPATH issues on
+# weaker make implementations (e.g. IRIX 6.5).
 .x_.y_:
-       cp $< $@
-
+       cp `test -f $< || echo $(srcdir)/`$< $@
 .y_.o:
-       cp $< $@
-
+       cp `test -f $< || echo $(srcdir)/`$< $@
 .y_.z_:
-       cp $< $@
-
+       cp `test -f $< || echo $(srcdir)/`$< $@
 .z_.lo:
-       cp $< $@
-
-# Add explicit dependencies to help make implementations that
-# don't otherwise chain implicit rules (e.g., Sun make).
-foo.$(OBJEXT): foo.y_
-bar.lo: bar.z_
-bar.z_: bar.y_
-
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
-       @echo BEGIN: $(libfoo_la_OBJECTS) :END
-
-test: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
+       cp `test -f $< || echo $(srcdir)/`$< $@
+
+# Some make implementations don't remove intermediate files
+# automatically, thus causing "make distcheck" to fail if
+# this is not added.
+MOSTLYCLEANFILES = *.y_ *.z_
+
+.PHONY: test0 test1 test2
+test0:
+       echo $(foo_OBJECTS) | grep '^foo\.foo$$'
+       echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
+test1:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
+       echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
+test2: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
        test -f foo.$(OBJEXT)
        test -f bar.lo
+check-local: test1 test2
 END
 
-echo 'int main() { return 0; }' > foo.x_
-cp foo.x_ bar.x_
+echo 'int main(void) { return 0; }' > foo.x_
+echo 'int bar(void) { return 0; }' > bar.x_
 
 libtoolize
 $ACLOCAL
@@ -71,11 +79,10 @@ $AUTOMAKE -a
 
 ./configure
 
-OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.foo :END' stdout
-$FGREP 'BEGIN: bar.lo :END' stdout
-
-$MAKE test
+OBJEXT=foo $MAKE -e test0
+$MAKE test1
+$MAKE test2
+$MAKE all
+$MAKE distcheck
 
 :
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]