2 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test to make sure Automake supports multiple derivations for the
21 required='cc libtoolize'
26 cat >>configure.ac <<'END'
32 cat >Makefile.am << 'END'
33 # $(LINK) is not defined automatically by Automake, since the *_SOURCES
34 # variables don't contain any known extension (.c, .cc, .f ...),
35 # So we need this hack.
39 lib_LTLIBRARIES = libfoo.la
42 libfoo_la_SOURCES = bar.x_
44 # The elaborate cp commands below account for VPATH issues on
45 # weaker make implementations (e.g. IRIX 6.5).
47 cp `test -f '$<' || echo $(srcdir)/`$< $@
49 cp `test -f '$<' || echo $(srcdir)/`$< $@
51 cp `test -f '$<' || echo $(srcdir)/`$< $@
53 cp `test -f '$<' || echo $(srcdir)/`$< $@
55 cp `test -f '$<' || echo $(srcdir)/`$< $@
57 # Some make implementations don't remove intermediate files
58 # automatically, thus causing "make distcheck" to fail if
60 MOSTLYCLEANFILES = *.y_ *.z_
62 .PHONY: test0 test1 test2
64 echo $(foo_OBJECTS) | grep '^foo\.foo$$'
65 echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
67 echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
68 echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
69 test2: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
72 check-local: test1 test2
75 echo 'int main (void) { return 0; }' > foo.x_
76 echo 'int bar (void) { return 0; }' > bar.x_
78 # We must protect the TAP driver from the output of configure, since
79 # that might output a stray "ok" on a line of its own (due to a
80 # libtool bug on Mac OS X), thus causing a spurious test result to
81 # be seen. See automake bug#11897.
84 st=0; "$@" >output 2>&1 || st=1
89 command_ok_ "libtoolize" libtoolize
90 command_ok_ "aclocal" $ACLOCAL
91 command_ok_ "autoconf" $AUTOCONF
92 command_ok_ "automake" $AUTOMAKE -a
93 command_ok_ "configure" protect_output ./configure
94 command_ok_ "make test0" run_make OBJEXT=foo test0
95 command_ok_ "make test1" $MAKE test1
97 directive=''; make_can_chain_suffix_rules || directive=TODO
99 for target in test2 all distcheck; do
100 command_ok_ "make $target" \
101 -D "$directive" -r "suffix rules not chained" \
102 protect_output $MAKE $target