2009-10-25 00:46:52 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test the --eval option.";
|
|
|
|
|
|
|
|
$details = "Verify that --eval options take effect,
|
|
|
|
and are passed to sub-makes.";
|
|
|
|
|
|
|
|
# Verify that --eval is evaluated first
|
|
|
|
run_make_test(q!
|
2016-12-28 05:41:38 +00:00
|
|
|
$(info infile)
|
2009-10-25 00:46:52 +00:00
|
|
|
BAR = bar
|
|
|
|
all: ; @echo all
|
|
|
|
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
|
2017-04-17 19:37:57 +00:00
|
|
|
['--eval=$(info eval)', 'FOO=$(BAR)'], "eval\ninfile\nall");
|
2009-10-25 00:46:52 +00:00
|
|
|
|
|
|
|
# Make sure that --eval is handled correctly during recursion
|
2017-04-17 19:37:57 +00:00
|
|
|
run_make_test(undef, ['--no-print-directory', '--eval=$(info eval)', 'recurse'],
|
2016-12-28 05:41:38 +00:00
|
|
|
"eval\ninfile\neval\ninfile\nall\nrecurse");
|
|
|
|
|
|
|
|
# Make sure that --eval is not passed in MAKEFLAGS
|
|
|
|
run_make_test(q!
|
|
|
|
all: ; @echo "MAKEFLAGS=$$MAKEFLAGS"
|
|
|
|
!,
|
2017-04-17 19:37:57 +00:00
|
|
|
['--eval=$(info eval)'],
|
2016-12-28 05:41:38 +00:00
|
|
|
"eval\n".'MAKEFLAGS= --eval=$$(info\ eval)');
|
2009-10-25 00:46:52 +00:00
|
|
|
|
2013-09-15 17:30:21 +00:00
|
|
|
# Make sure that --eval is handled correctly during restarting
|
|
|
|
run_make_test(q!
|
|
|
|
all: ; @echo $@
|
|
|
|
-include gen.mk
|
|
|
|
gen.mk: ; @echo > $@
|
|
|
|
!,
|
2017-04-17 19:37:57 +00:00
|
|
|
['--eval=$(info eval)'], "eval\neval\nall");
|
2013-09-15 17:30:21 +00:00
|
|
|
|
|
|
|
unlink('gen.mk');
|
|
|
|
|
2016-12-28 05:41:38 +00:00
|
|
|
# Check -E
|
|
|
|
run_make_test(q!
|
|
|
|
BAR = bar
|
|
|
|
all: ; @echo all
|
|
|
|
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
|
2017-04-17 19:37:57 +00:00
|
|
|
['-E', '$(info eval)', 'FOO=$(BAR)'], "eval\nall");
|
2016-12-28 05:41:38 +00:00
|
|
|
|
2009-10-25 00:46:52 +00:00
|
|
|
1;
|