Merge branch 'minor'
[automake.git] / t / remake-deleted-am-subdir.sh
blobc7888ea664fd59a7233fd1ab06bcfce3f9263560
1 #! /bin/sh
2 # Copyright (C) 2011-2017 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 <https://www.gnu.org/licenses/>.
17 # Check that inclusion of '.am' fragments by automake does not suffer
18 # of the "deleted header problem". This test does the check when the
19 # SUBDIRS variable is involved.
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
25 AC_OUTPUT
26 END
28 $ACLOCAL
29 $AUTOCONF
31 cat > Makefile.am <<'END'
32 include foo.am
33 SUBDIRS = sub1 sub2
34 END
36 echo '# this is foo.am' > foo.am
38 mkdir sub1 sub2
40 echo 'include $(srcdir)/bar.am' > sub1/Makefile.am
41 echo '# this is bar.am' > sub1/bar.am
43 echo 'include $(top_srcdir)/foo.am' > sub2/Makefile.am
45 $AUTOMAKE
46 # Sanity checks.
47 $FGREP 'this is foo.am' Makefile.in
48 $FGREP 'this is bar.am' sub1/Makefile.in
49 $FGREP 'this is foo.am' sub2/Makefile.in
51 ./configure
52 $MAKE # Should be no-op.
54 $sleep
55 echo '# this is sub1/Makefile.am' > sub1/Makefile.am
56 rm -f sub1/bar.am
57 $MAKE all
58 # Sanity checks.
59 $FGREP 'this is bar' sub1/Makefile.in sub1/Makefile && exit 1
60 $FGREP 'this is sub1/Makefile.am' sub1/Makefile.in
61 $FGREP 'this is sub1/Makefile.am' sub1/Makefile
63 $sleep
64 for d in . sub2; do
65 sed "s|.*include.*foo\.am.*|# this is $d/Makefile.am|" $d/Makefile.am > t
66 mv -f t $d/Makefile.am
67 done
68 rm -f foo.am
69 $MAKE all
70 # Sanity checks.
71 $FGREP 'this is foo' sub*/Makefile* Makefile* && exit 1
72 for d in . sub1 sub2; do
73 $FGREP "this is $d/Makefile.am" $d/Makefile.in
74 $FGREP "this is $d/Makefile.am" $d/Makefile
75 done