sync: update files from upstream with "make fetch"
[automake.git] / t / suffix6b.sh
blobcfd1662158c7cd9cd9f51f7b7360954c070bc93d
1 #! /bin/sh
2 # Copyright (C) 2001-2012 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)
7 # any later version.
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 implicit rules with dot-less
18 # extensions. Se also related "grepping" test 'suffix6.sh'.
20 required=GNUmake # Other makes might not grok dot-less suffix rules.
21 . ./defs || exit 1
23 cat >> configure.ac << 'END'
24 # $(LINK) is not defined automatically by Automake, since the *_SOURCES
25 # variables don't contain any known extension (.c, .cc, .f, ...).
26 # So we need this hack -- but since such an hack can also serve as a
27 # mild stress test, that's ok.
28 AC_SUBST([LINK], ['cat >$@'])
29 AC_SUBST([OBJEXT], [oOo])
30 AC_SUBST([EXEEXT], [.XxX])
31 AC_OUTPUT
32 END
34 cat > Makefile.am << 'END'
35 SUFFIXES = a b c .$(OBJEXT)
36 bin_PROGRAMS = foo
37 foo_SOURCES = fooa
38 ab:
39 { echo '=ab=' && cat $<; } >$@
40 bc:
41 { echo '=bc=' && cat $<; } >$@
42 c.$(OBJEXT):
43 { echo '=b.obj=' && cat $<; } >$@
44 test:
45 : For debugging.
46 ls -l
47 : Implicit intermediate files should be removed by GNU make ...
48 test ! -r foob
49 test ! -r fooc
50 : ... but object files should not.
51 cat foo.$(OBJEXT)
52 : For debugging.
53 cat foo.XxX
54 : Now check that the chain of implicit rules has been executed
55 : completely and in the correct order.
56 (echo =b.obj= && echo =bc= && echo =ab= && echo =src=) > exp
57 diff exp foo.XxX
58 rm -f exp
59 .PHONY: test
60 check-local: test
61 END
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE
67 ./configure
69 echo =src= > fooa
71 $MAKE
72 $MAKE test
73 $MAKE distcheck