maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / suffix3.tap
1 #! /bin/sh
2 # Copyright (C) 1999-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 # Test to make sure that suffix rules chain.
18
19 required=c++
20 . ./defs || Exit 1
21
22 plan_ 10
23
24 cat >> configure.in << 'END'
25 AC_PROG_CXX
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 SUFFIXES = .zoo
31 .zoo.cc:
32         sed 's/INTEGER/int/g' `test -f '$<' || echo $(srcdir)/`$< >$@
33 bin_PROGRAMS = foo
34 foo_SOURCES = foo.zoo
35 # This is required by "make distcheck".  The useless indirection is
36 # reequired to avoid false positives by the grepping checks below.
37 FOO = foo
38 CLEANFILES = $(FOO).cc
39 END
40
41 command_ok_ "aclocal" $ACLOCAL
42 command_ok_ "automake" $AUTOMAKE
43
44 # The foo.cc intermediate step is implicit, it's a mistake if
45 # Automake requires this file somewhere.  Also, Automake should
46 # not require the file `foo.c' anywhere.
47 command_ok_ "intermediate files not mentioned" \
48   not $FGREP foo.c Makefile.in
49 # However Automake must figure that foo.zoo is eventually
50 # transformed into foo.o, and use this latter file (to link foo).
51 command_ok_ "final object file figured out" \
52   $FGREP 'foo.$(OBJEXT)' Makefile.in
53
54 command_ok_ "autoconf" $AUTOCONF
55 command_ok_ "configure" ./configure
56
57 # This is deliberately valid C++, but invalid C.
58 cat > foo.zoo <<'END'
59 #include <iostream>
60 using namespace std;
61 INTEGER main (void)
62 {
63   return 0;
64 }
65 END
66
67 directive=''; make_can_chain_suffix_rules || directive=TODO
68
69 for target in all distcheck; do
70   command_ok_ "make $target"  \
71               -D "$directive" -r "suffix rules not chained" \
72               $MAKE $target
73 done
74
75 # FIXME: should we check that intermediate file `foo.cc' has
76 # been removed?  Or is this requiring too much from the make
77 # implementation?
78
79 # Intermediate files should not be distributed.
80 command_ok_ "make distdir" $MAKE distdir
81 command_ok_ "intermediate file not distributed" test ! -r $me-1.0/foo.cc
82
83 :