From d47051ef10f0f2bea552a8084edb70eff779fa72 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini 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 224c3e014..a3076fae3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2010-12-23 Stefano Lattarini + + 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-23 Ralf Wildenhues Stefano Lattarini diff --git a/tests/Makefile.am b/tests/Makefile.am index 8842be389..7b0a65ad6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -715,6 +715,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 a9d1fd10a..bc92de176 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -982,6 +982,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 c790c66a4..4e8136609 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 . -# 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 131359c8f..0398d89d2 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 $@ $@-t +## 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)/`$<; \ + } > $@-t + mv -f $@-t $@ +.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 91d2cf4d3..ec4f5a197 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 21089a549..40f7b3fdf 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 aa5a3edbf..d37643a75 100755 --- a/tests/suffix13.test +++ b/tests/suffix13.test @@ -70,7 +70,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 405ce90c5..e2fd663e4 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 . -# 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 fc445bf51..0ec457ef4 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 +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 e95228315..b83c28097 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 b3b36aaea..f661620d8 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 ab7cf6459..7bfabb341 100755 --- a/tests/suffix6.test +++ b/tests/suffix6.test @@ -15,32 +15,51 @@ # along with this program. If not, see . # 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 000000000..a96c94178 --- /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 . + +# 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 000000000..e4b84cc85 --- /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 . + +# 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 .@OBJEXT@ + +bin_PROGRAMS = foo +foo_SOURCES = foo.zoo + +.zoo.o: + { echo '=.zoo.o=' && cat $<; } >$@ +.zoo.obj: + { echo '=.zoo.obj=' && cat $<; } >$@ +.zoo.@OBJEXT@: + { echo '=.zoo.@OBJEXT@=' && 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 70ff3a590..8760d7bd2 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 . -# 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 : -- 2.47.2