2 # Copyright (C) 2010-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)
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 <http://www.gnu.org/licenses/>.
17 # Test remake rules when Makefile.am or its prerequisites change.
18 # Keep in sync with the other sister tests 'remake-after-*.sh'.
23 remake_
() { $MAKE nil
; }
25 remake_
() { $MAKE Makefile
&& $MAKE foo.sh
; }
28 magic1
=::MagicStringOne
::
29 magic2
=__MagicStringTwo__
31 cat >> configure.ac
<<END
35 cat > Makefile.am
<<'END'
36 FINGERPRINT = BadBadBad
42 $(srcdir)/Makefile.am: $(srcdir)/tweak-makefile-am
43 $(SHELL) $(srcdir)/tweak-makefile-am <$@ >$@-t
45 EXTRA_DIST = $(srcdir)/tweak-makefile-am
49 echo '#!/bin/sh' > $@-t
50 echo "echo '$(FINGERPRINT)'" >> $@-t
51 chmod a+x $@-t && mv -f $@-t $@
54 # Used by "make distcheck" later.
56 test x'$(FINGERPRINT)' = x'DummyValue'
57 test x"`./foo.sh`" = x"DummyValue"
60 echo cat > tweak-makefile-am
# It is a no-op by default.
66 for vpath
in : false
; do
77 $MAKE # Should be a no-op.
80 sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = $magic1/" $srcdir/Makefile.am
>t
81 mv -f t
$srcdir/Makefile.am
83 $FGREP FINGERPRINT Makefile
# For debugging.
84 $FGREP $magic1 Makefile
85 test x
"$(./foo.sh)" = x
"$magic1"
88 echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \
89 > $srcdir/tweak-makefile-am
91 $FGREP FINGERPRINT Makefile
# For debugging.
92 $FGREP $magic1 Makefile
&& exit 1
93 $FGREP $magic2 Makefile
94 test x
"$(./foo.sh)" = x
"$magic2"
97 echo cat > $srcdir/tweak-makefile-am
# Make it a no-op again.
98 sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am
>t
99 mv -f t
$srcdir/Makefile.am
100 using_gmake || remake_
102 $FGREP $magic1 Makefile
&& exit 1 # Sanity check.
103 $FGREP $magic2 Makefile
&& exit 1 # Likewise.