mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-02-04 22:02:19 +00:00
* main.c (switches): Add -E as an alias for --eval.
* make.1: Document the -E and --eval options. * doc/make.texi: Document the -E option. * tests/scripts/options/eval: Test the -E option and MAKEFILES. * NEWS: Add information about the new option.
This commit is contained in:
parent
3daaa4dd3e
commit
d351c1fef2
5 changed files with 29 additions and 6 deletions
2
NEWS
2
NEWS
|
@ -36,6 +36,8 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
|
||||||
* A new option --no-silent has been added, that cancels the effect of the
|
* A new option --no-silent has been added, that cancels the effect of the
|
||||||
-s/--silent/--quiet flag.
|
-s/--silent/--quiet flag.
|
||||||
|
|
||||||
|
* A new option -E has been added as a short alias for --eval.
|
||||||
|
|
||||||
|
|
||||||
Version 4.2.1 (10 Jun 2016)
|
Version 4.2.1 (10 Jun 2016)
|
||||||
|
|
||||||
|
|
|
@ -8657,6 +8657,8 @@ Give variables taken from the environment precedence
|
||||||
over variables from makefiles.
|
over variables from makefiles.
|
||||||
@xref{Environment, ,Variables from the Environment}.
|
@xref{Environment, ,Variables from the Environment}.
|
||||||
|
|
||||||
|
@item -E @var{string}
|
||||||
|
@cindex @code{-E}
|
||||||
@item --eval=@var{string}
|
@item --eval=@var{string}
|
||||||
@cindex @code{--eval}
|
@cindex @code{--eval}
|
||||||
@c Extra blank line here makes the table look better.
|
@c Extra blank line here makes the table look better.
|
||||||
|
|
4
main.c
4
main.c
|
@ -350,7 +350,7 @@ static const char *const usage[] =
|
||||||
-e, --environment-overrides\n\
|
-e, --environment-overrides\n\
|
||||||
Environment variables override makefiles.\n"),
|
Environment variables override makefiles.\n"),
|
||||||
N_("\
|
N_("\
|
||||||
--eval=STRING Evaluate STRING as a makefile statement.\n"),
|
-E STRING, --eval=STRING Evaluate STRING as a makefile statement.\n"),
|
||||||
N_("\
|
N_("\
|
||||||
-f FILE, --file=FILE, --makefile=FILE\n\
|
-f FILE, --file=FILE, --makefile=FILE\n\
|
||||||
Read FILE as a makefile.\n"),
|
Read FILE as a makefile.\n"),
|
||||||
|
@ -425,6 +425,7 @@ static const struct command_switch switches[] =
|
||||||
{ 'D', flag, &suspend_flag, 1, 1, 0, 0, 0, "suspend-for-debug" },
|
{ 'D', flag, &suspend_flag, 1, 1, 0, 0, 0, "suspend-for-debug" },
|
||||||
#endif
|
#endif
|
||||||
{ 'e', flag, &env_overrides, 1, 1, 0, 0, 0, "environment-overrides", },
|
{ 'e', flag, &env_overrides, 1, 1, 0, 0, 0, "environment-overrides", },
|
||||||
|
{ 'E', strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
|
||||||
{ 'h', flag, &print_usage_flag, 0, 0, 0, 0, 0, "help" },
|
{ 'h', flag, &print_usage_flag, 0, 0, 0, 0, 0, "help" },
|
||||||
{ 'i', flag, &ignore_errors_flag, 1, 1, 0, 0, 0, "ignore-errors" },
|
{ 'i', flag, &ignore_errors_flag, 1, 1, 0, 0, 0, "ignore-errors" },
|
||||||
{ 'k', flag, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
|
{ 'k', flag, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
|
||||||
|
@ -465,7 +466,6 @@ static const struct command_switch switches[] =
|
||||||
"no-print-directory" },
|
"no-print-directory" },
|
||||||
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
||||||
"warn-undefined-variables" },
|
"warn-undefined-variables" },
|
||||||
{ CHAR_MAX+6, strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
|
|
||||||
{ CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
|
{ CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
|
||||||
{ CHAR_MAX+8, flag_off, &silent_flag, 1, 1, 0, 0, &default_silent_flag, "no-silent" },
|
{ CHAR_MAX+8, flag_off, &silent_flag, 1, 1, 0, 0, &default_silent_flag, "no-silent" },
|
||||||
{ CHAR_MAX+9, string, &jobserver_auth, 1, 0, 0, 0, 0, "jobserver-fds" },
|
{ CHAR_MAX+9, string, &jobserver_auth, 1, 0, 0, 0, 0, "jobserver-fds" },
|
||||||
|
|
8
make.1
8
make.1
|
@ -148,8 +148,12 @@ for debugging while remaking makefiles. Use
|
||||||
to disable all previous debugging flags.
|
to disable all previous debugging flags.
|
||||||
.TP 0.5i
|
.TP 0.5i
|
||||||
\fB\-e\fR, \fB\-\-environment\-overrides\fR
|
\fB\-e\fR, \fB\-\-environment\-overrides\fR
|
||||||
Give variables taken from the environment precedence
|
Give variables taken from the environment precedence over variables
|
||||||
over variables from makefiles.
|
from makefiles.
|
||||||
|
.TP 0.5i
|
||||||
|
\fB\-E\fR \fIstring\fR, \fB\-\-eval\fR \fIstring\fR
|
||||||
|
Interpret \fIstring\fR using the \fBeval\fR function, before parsing any
|
||||||
|
makefiles.
|
||||||
.TP 0.5i
|
.TP 0.5i
|
||||||
\fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR
|
\fB\-f\fR \fIfile\fR, \fB\-\-file\fR=\fIfile\fR, \fB\-\-makefile\fR=\fIFILE\fR
|
||||||
Use
|
Use
|
||||||
|
|
|
@ -7,14 +7,22 @@ and are passed to sub-makes.";
|
||||||
|
|
||||||
# Verify that --eval is evaluated first
|
# Verify that --eval is evaluated first
|
||||||
run_make_test(q!
|
run_make_test(q!
|
||||||
|
$(info infile)
|
||||||
BAR = bar
|
BAR = bar
|
||||||
all: ; @echo all
|
all: ; @echo all
|
||||||
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
|
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
|
||||||
'--eval=\$\(info\ eval\) FOO=\$\(BAR\)', "eval\nall");
|
'--eval=\$\(info\ eval\) FOO=\$\(BAR\)', "eval\ninfile\nall");
|
||||||
|
|
||||||
# Make sure that --eval is handled correctly during recursion
|
# Make sure that --eval is handled correctly during recursion
|
||||||
run_make_test(undef, '--no-print-directory --eval=\$\(info\ eval\) recurse',
|
run_make_test(undef, '--no-print-directory --eval=\$\(info\ eval\) recurse',
|
||||||
"eval\neval\nall\nrecurse");
|
"eval\ninfile\neval\ninfile\nall\nrecurse");
|
||||||
|
|
||||||
|
# Make sure that --eval is not passed in MAKEFLAGS
|
||||||
|
run_make_test(q!
|
||||||
|
all: ; @echo "MAKEFLAGS=$$MAKEFLAGS"
|
||||||
|
!,
|
||||||
|
'--eval=\$\(info\ eval\)',
|
||||||
|
"eval\n".'MAKEFLAGS= --eval=$$(info\ eval)');
|
||||||
|
|
||||||
# Make sure that --eval is handled correctly during restarting
|
# Make sure that --eval is handled correctly during restarting
|
||||||
run_make_test(q!
|
run_make_test(q!
|
||||||
|
@ -26,4 +34,11 @@ gen.mk: ; @echo > $@
|
||||||
|
|
||||||
unlink('gen.mk');
|
unlink('gen.mk');
|
||||||
|
|
||||||
|
# Check -E
|
||||||
|
run_make_test(q!
|
||||||
|
BAR = bar
|
||||||
|
all: ; @echo all
|
||||||
|
recurse: ; @$(MAKE) -f #MAKEFILE# && echo recurse!,
|
||||||
|
'-E \$\(info\ eval\) FOO=\$\(BAR\)', "eval\nall");
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
Loading…
Reference in a new issue