tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / colon6.sh
1 #! /bin/sh
2 # Copyright (C) 1998-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 # Yet another multi-":" test, this time from Ken Pizzini.
18
19 . test-init.sh
20
21 cat > configure.ac <<END
22 AC_INIT([$me], [1.0])
23 AM_INIT_AUTOMAKE
24 # With this, version.good should depend on version.gin, while
25 # Makefile should not depend on either of them.
26 AC_CONFIG_FILES([demo/Makefile demo/version.good:demo/version.gin])
27 AC_OUTPUT
28 END
29
30 mkdir demo
31 : > demo/version.gin
32 : > demo/Makefile.am
33
34 $ACLOCAL
35 $AUTOMAKE
36
37 # These are older "grepping checks", kept mostly for backward-compatibility.
38 # They might (unlikely, but possibly) require updating when automake
39 # internals are changed.  Just relax or remove if they become too fragile.
40 $EGREP 'Makefile:.*(demo|version)' demo/Makefile.in && exit 1
41 grep 'version\.good:.*version\.gin' demo/Makefile.in
42
43 $AUTOCONF
44
45 for vpath in : false; do
46
47   if $vpath; then
48     srcdir=..
49     mkdir build
50     cd build
51   else
52     srcdir=.
53   fi
54
55   $srcdir/configure
56
57   test -f demo/version.good   # Sanity check.
58   test ! -s demo/version.good # Likewise.
59
60   cd demo
61
62   $sleep
63   # HP-UX make considers targets with exact time stamps as one of their
64   # prerequisites out of date.  Ensure Makefile is newer than config.status to
65   # avoid triggering the am--refresh rule in the (here-nonexistent) toplevel
66   # Makefile.
67   touch Makefile
68
69   # version.good should depend on version.gin.
70   echo "Rebuilt (srcdir=$srcdir)" > ../$srcdir/demo/version.gin
71   $MAKE version.good
72   $FGREP "Rebuilt (srcdir=$srcdir)" version.good
73
74   # Makefile should not depend on version.good.
75   rm -f version.good
76   $MAKE Makefile
77   test ! -e version.good
78
79   # version.good should be rebuilt from version.gin.
80   $MAKE version.good
81   test -f version.good
82
83   # Makefile should not depend on version.gin.
84   rm -f ../$srcdir/demo/version.gin
85   $MAKE Makefile
86   test ! -e ../$srcdir/demo/version.gin # Sanity check.
87
88   # version.good should depend on version.gin.
89   rm -f version.good
90   run_make -M -e FAIL version.good
91   # Try to verify that we errored out for the right reason.
92   $FGREP version.gin output
93
94   cd .. # Back in top builddir.
95   cd $srcdir
96
97   # Re-create it for the next pass (if any).
98   : > demo/version.gin
99
100 done
101
102 :