Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / make-dryrun.test
1 #! /bin/sh
2 # Copyright (C) 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 # Check that $(am__make_dryrun) works as expected.
18
19 . ./defs || Exit 1
20
21 set -e
22
23 mkdir sub
24
25 echo AC_OUTPUT >> configure.in
26
27 cat > Makefile.am <<'END'
28 all:
29         : Dummy, nothing to do.
30 foo:
31         $(MAKE) all
32 notdry:
33         @echo ":: $$MAKEFLAGS ::"; : For debugging.
34         $(am__make_dryrun) && exit 1; exit 0
35 dry:
36         +@echo ":: $$MAKEFLAGS ::"; : For debugging.
37         +$(am__make_dryrun) || exit 1; echo ok > from-dry-mode
38 END
39
40 $ACLOCAL
41 $AUTOCONF
42 $AUTOMAKE
43 ./configure
44
45 $MAKE notdry
46
47 # Test against a known regressions.  This was especially
48 # heinous, since make running in normal mode was sometimes
49 # mistaken for make running in dry mode.
50 $MAKE notdry TESTS="n1.test n2.test"
51 $MAKE notdry TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'"
52 $MAKE notdry TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"'
53 $MAKE notdry FOOFLAGS="-n -n -knf2 \\n --none -n"
54 $MAKE notdry BARFLAGS="-n \"n\" '-n' --none -n"
55
56 if echo 'all: ; @+printf %sbb%s aa cc' | $MAKE -n -f - | grep aabbcc; then
57   $MAKE -n dry
58   test -f from-dry-mode
59   rm -f from-dry-mode
60 fi
61
62 if using_gmake; then
63   $MAKE --dry-run -k dry
64   test -f from-dry-mode
65 fi
66
67 :