test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / recurs-user-phony.sh
1 #! /bin/sh
2 # Copyright (C) 2012-2013 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 # Check that user-defined recursive targets and their associate
18 # '-local', '-am' and '-recursive' targets are declared as phony.
19
20 # Require GNU make, because some vendo makes (e.g., Solaris) doesn't
21 # truly respect .PHONY.
22 required=GNUmake
23 . test-init.sh
24
25 cat >> configure.ac <<'END'
26 AC_CONFIG_FILES([sub/Makefile])
27 AM_EXTRA_RECURSIVE_TARGETS([foo])
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am <<'END'
32 SUBDIRS = sub
33 foo-local:
34         echo 'GOOD!' > foo
35 END
36
37 mkdir sub
38 cat > sub/Makefile.am <<'END'
39 foo-local:
40         echo 'GOOD!' > foo
41 END
42
43 dummy_files='
44   foo
45   foo-local
46   foo-am
47   foo-recursive
48   sub/foo
49   sub/foo-local
50   sub/foo-am
51 '
52
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE
56 ./configure
57
58 touch $dummy_files
59
60 $MAKE foo
61 grep 'GOOD!' foo
62 grep 'GOOD!' sub/foo
63
64 :