maint: Update HACKING
[automake.git] / t / remake-deleted-am.sh
blob2204ed898966d2f452b333dfd0428786eb48a658
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". Basic checks are done here.
20 . test-init.sh
22 echo AC_OUTPUT >> configure.ac
24 $ACLOCAL
25 $AUTOCONF
27 cat > Makefile.am <<'END'
28 include foo.am
29 include $(srcdir)/bar.am
30 include $(top_srcdir)/baz.am
31 END
33 echo '# this is foo' > foo.am
34 echo '# this is bar' > bar.am
35 echo '# this is baz' > baz.am
37 $AUTOMAKE
38 # Sanity checks.
39 $FGREP 'this is foo' Makefile.in
40 $FGREP 'this is bar' Makefile.in
41 $FGREP 'this is baz' Makefile.in
43 ./configure
44 $MAKE # Should be no-op.
46 $sleep
47 sed '/^include foo\.am$/d' Makefile.am > t
48 mv -f t Makefile.am
49 rm -f foo.am
50 $MAKE Makefile
51 # Sanity checks.
52 $FGREP 'this is foo' Makefile.in Makefile && exit 1
53 $FGREP 'this is bar' Makefile.in
54 $FGREP 'this is bar' Makefile
55 $FGREP 'this is baz' Makefile.in
56 $FGREP 'this is baz' Makefile
58 $sleep
59 echo '# empty empty' > Makefile.am
60 rm -f bar.am baz.am
61 $MAKE Makefile
62 # Sanity checks.
63 $FGREP 'empty empty' Makefile.in
64 $FGREP 'empty empty' Makefile
65 grep 'this is ba[rz]' Makefile Makefile.in && exit 1