tests: rename 'tests/' => 't/', '*.test' => '*.sh'
[platform/upstream/automake.git] / t / remake3a.sh
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Ensure that remake rules work for files in a subdirectory even when
18 # there is no Makefile for that subdirectory.
19 # See also sister "grepping" test 'remake3.test'.
20
21 . ./defs || Exit 1
22
23 cat >> configure.ac << 'END'
24 AC_CONFIG_FILES([sub/foo])
25 AC_OUTPUT
26 END
27
28 cat > Makefile.am <<'END'
29 all-local: sub/foo
30 END
31
32 mkdir sub
33 : > sub/foo.in
34
35 $ACLOCAL
36 $AUTOCONF
37 $AUTOMAKE
38
39 # First a VPATH build.
40 mkdir build
41 cd build
42 ../configure
43 $sleep
44 test -f sub/foo
45 test ! -s sub/foo
46 echo '#GrepMe#' > ../sub/foo.in
47 $MAKE
48 grep '#GrepMe#' sub/foo
49
50 cd ..
51
52 # Now try an in-tree build.
53 : > sub/foo.in # Restore its original (empty) content.
54 ./configure
55 $sleep
56 test -f sub/foo
57 test ! -s sub/foo
58 echo '#GrepMe#' > sub/foo.in
59 $MAKE
60 grep '#GrepMe#' sub/foo
61
62 # Finally try to check the distribution.
63 $sleep
64 echo '%GrepMe%' > sub/foo.in
65 cat >>Makefile.am <<END
66 check-local:
67         grep '%GrepMe%' sub/foo
68 END
69 $MAKE
70 grep "grep '%GrepMe%' sub/foo" Makefile.in # Sanity check.
71 $MAKE distcheck
72
73 :