tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / colon3.sh
blob5ef22673a7f5c5e7d0b176078316bb21abfd79f6
1 #! /bin/sh
2 # Copyright (C) 1996-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 # Make sure ":" works with files automake generates.
18 # This test is for multiple ":"s.
19 # See also sister test 'colon2.test'.
21 . ./defs || exit 1
23 cat > configure.ac <<END
24 AC_INIT([$me], [1.0])
25 AM_INIT_AUTOMAKE
26 AC_CONFIG_FILES([Makefile:zardoz.in:two.in:three.in])
27 AC_OUTPUT
28 END
30 cat > zardoz.am <<END
31 .PHONY: dummy
32 dummy:
33 END
35 : > two.in
36 : > three.in
38 $ACLOCAL
39 $AUTOMAKE
41 # Automake should have created zardoz.in.
42 test -f zardoz.in
44 # The generated file should refer to zardoz.in and zardoz.am, but
45 # never just "zardoz".
46 $FGREP 'zardoz.am' zardoz.in
47 $FGREP 'zardoz.in' zardoz.in
48 sed -e 's|zardoz\.am|zrdz.am|g' \
49 -e 's|zardoz\.in|zrdz.in|g' \
50 <zardoz.in | $FGREP 'zardoz' && exit 1
52 # The configure-generated Makefile should depend on zardoz.in, two.in and
53 # three.in. The automake-generated zardoz.in should depend on zardoz.am.
54 # Let's do this check the right way by running configure and make.
56 str='%% ZaR DoZ %%'
57 str2='// 2_TwO_2 //'
58 str3='== @thr33@ =='
60 $AUTOCONF
61 ./configure
62 test -f Makefile # Sanity check.
64 $MAKE dummy
65 # Again, make sure that the generated Makefile do not unduly
66 # refer to 'zardoz' .
67 $MAKE -n zardoz && exit 1
69 $sleep
70 cat >> zardoz.am <<END
71 check-local: testam testin testmk test2 test3
72 .PHONY: testam testin test2 testmk test3
73 testam:
74 grep '$str' \$(srcdir)/zardoz.am
75 testin:
76 grep '$str' \$(srcdir)/zardoz.in
77 testmk:
78 grep '$str' Makefile
79 test2:
80 grep '$str2' \$(srcdir)/two.in
81 test3:
82 grep '$str3' \$(srcdir)/three.in
83 END
84 echo "# $str2" >> two.in
85 echo "# $str3" >> three.in
86 $MAKE Makefile # For non-GNU make.
87 $MAKE testam testin testmk test2 test3
89 $MAKE distcheck