Imported Upstream version 4.0
[platform/upstream/make.git] / tests / scripts / variables / MAKEFLAGS
1 #                                                                    -*-perl-*-
2
3 $description = "Test proper behavior of MAKEFLAGS";
4
5 $details = "DETAILS";
6
7 # Normal flags aren't prefixed with "-"
8 run_make_test(q!
9 all: ; @echo $(MAKEFLAGS)
10 !,
11               '-e -r -R', 'erR');
12
13 # Long arguments mean everything is prefixed with "-"
14 run_make_test(q!
15 all: ; @echo $(MAKEFLAGS)
16 !,
17               '--no-print-directory -e -r -R --trace', "#MAKEFILE#:2: target 'all' does not exist
18 echo erR --trace --no-print-directory
19 erR --trace --no-print-directory");
20
21
22 # Recursive invocations of make should accumulate MAKEFLAGS values.
23 # Savannah bug #2216
24 run_make_test(q!
25 MSG = Fails
26 all:
27         @echo '$@: MAKEFLAGS=$(MAKEFLAGS)'
28         @MSG=Works $(MAKE) -e -f #MAKEFILE# jump
29 jump:
30         @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)'
31         @$(MAKE) -f #MAKEFILE# print
32 print:
33         @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)'
34 .PHONY: all jump print
35 !,
36                   '--no-print-directory',
37                   'all: MAKEFLAGS= --no-print-directory
38 jump Works: MAKEFLAGS=e --no-print-directory
39 print Works: MAKEFLAGS=e --no-print-directory');
40
41 1;