Merge branch 'maint'
[platform/upstream/automake.git] / t / suffix11.tap
1 #! /bin/sh
2 # Copyright (C) 2002-2012 Free Software Foundation, Inc.
3 #
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)
7 # any later version.
8 #
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.
13 #
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/>.
16
17 # Tests that Automake understands multiple suffix rules on the same line.
18 # PR/371 and PR/372: Reported by Duncan Gibson.
19 # We also check for suffixes containing '-'.
20
21 required=cc
22 . test-init.sh
23
24 plan_ 10
25
26 cat >>configure.ac <<EOF
27 AC_PROG_CC
28 AC_OUTPUT
29 EOF
30
31 cat >Makefile.am << 'END'
32 bin_PROGRAMS = foo bar baz
33 foo_SOURCES = foo.x_
34 bar_SOURCES = bar.y-z
35 baz_SOURCES = baz1.x_ baz2.y-z
36
37 .y-z.c .x_.c:
38 ## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5).
39         sed 's/INTEGER/int/g' `test -f '$<' || echo $(srcdir)/`$< >$@
40
41 CLEANFILES = foo.c bar.c baz1.c baz2.c
42
43 .PHONY: test-real test-fake
44 test-fake:
45         echo $(foo_OBJECTS) | grep '^foo\.foo$$'
46         echo $(bar_OBJECTS) | grep '^bar\.foo$$'
47         echo $(baz_OBJECTS) | grep '^baz1\.foo baz2\.foo$$'
48 test-real:
49         echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
50         echo $(bar_OBJECTS) | grep '^bar\.$(OBJEXT)$$'
51         echo $(baz_OBJECTS) | grep '^baz1\.$(OBJEXT) baz2\.$(OBJEXT)$$'
52 check-local: test-real
53 END
54
55 echo 'INTEGER main(void) { return 0; }' > foo.x_
56 echo 'INTEGER main(void) { return 0; }' > bar.y-z
57 echo 'INTEGER main(void) { INTEGER baz(void); return baz(); }' > baz1.x_
58 echo 'INTEGER baz(void) { return 0; }' > baz2.y-z
59
60 command_ok_ "aclocal" $ACLOCAL
61 command_ok_ "autoconf" $AUTOCONF
62
63 # What we do is not portable.  Automake should warn.
64 AUTOMAKE_fails -a
65 command_ok_ "warn about unportable make usage" \
66   grep '[iI]nference rules can have only one target before the colon' stderr
67 # But this should work anyway.
68 command_ok_ "automake" $AUTOMAKE -a -Wno-portability
69
70 command_ok_ "configure"  ./configure
71 command_ok_ "make test-fake" env OBJEXT=foo $MAKE -e test-fake
72 command_ok_ "make test-real" $MAKE test-real
73
74 directive=''; make_can_chain_suffix_rules || directive=TODO
75
76 for target in '' distcheck; do
77   command_ok_ "make $target" \
78               -D "$directive" -r "suffix rules not chained" \
79               $MAKE $target
80 done
81
82 :