Merge branch 'maint'
[platform/upstream/automake.git] / t / suffix10.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 # Make sure that derivations work with .lo too.
18 # (related to PR/37)
19
20 required='cc libtoolize yacc'
21 . ./defs || Exit 1
22
23 plan_ 7
24
25 cat >>configure.ac <<EOF
26 AC_PROG_CC
27 AC_PROG_YACC
28 AM_PROG_AR
29 AC_PROG_LIBTOOL
30 AC_OUTPUT
31 EOF
32
33 cat >Makefile.am << 'END'
34 lib_LTLIBRARIES = libfoo.la
35 libfoo_la_SOURCES = foo.x_
36 .x_.y:
37         rm -f $@ $@-t
38 ## The leading ':;' works around a bug in bash <= 3.2.
39         :; { echo '/* autogenerated */' \
40           && echo '%{' \
41           && echo 'int yylex () {return 0;}' \
42           && echo 'void yyerror (char *s) {}' \
43           && echo '%}' \
44           && echo '%%' \
45           && echo "foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};" \
46           && echo '%%' \
47 ## Account for VPATH issues on weaker make implementations.
48           && cat `test -f '$<' || echo $(srcdir)/`$<; \
49         } > $@-t
50         mv -f $@-t $@
51 .PHONY: test
52 test:
53         echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$'
54 END
55
56 cat > foo.x_ << 'END'
57 int foo (void) { return yyparse(); }
58 END
59
60 command_ok_ "libtoolize" libtoolize --force
61 command_ok_ "aclocal"    $ACLOCAL
62 command_ok_ "autoconf"   $AUTOCONF
63 command_ok_ "automake"   $AUTOMAKE --add-missing
64 command_ok_ "configure"  ./configure
65 command_ok_ "make test"  $MAKE test
66
67 directive=''; make_can_chain_suffix_rules || directive=TODO
68 command_ok_ "make all" -D "$directive" -r "suffix rules not chained" \
69             $MAKE all
70
71 :