mirror of
https://github.com/mirror/make.git
synced 2025-03-27 20:40:35 +08:00
Add a new variable: GNUMAKEFLAGS
This allows you to write portable makefiles that set GNU make-specific command line options in the environment or makefile: add them to GNUMAKEFLAGS instead of MAKEFLAGS and they will be seen by GNU make but ignored by other implementations of make.
This commit is contained in:
parent
2627d83221
commit
c7732bd5ad
19
NEWS
19
NEWS
@ -23,12 +23,6 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
|
|||||||
* Each backslash/newline (plus subsequent whitespace) is converted to a
|
* Each backslash/newline (plus subsequent whitespace) is converted to a
|
||||||
single space
|
single space
|
||||||
|
|
||||||
* New command line option: --trace enables tracing of targets. When enabled
|
|
||||||
the recipe to be invoked is printed even if it would otherwise be suppressed
|
|
||||||
by .SILENT or a "@" prefix character. Also before each recipe is run the
|
|
||||||
makefile name and linenumber where it was defined are shown as well as the
|
|
||||||
prerequisites that caused the target to be considered out of date.
|
|
||||||
|
|
||||||
* New command line option: --output-sync (-O) enables grouping of output by
|
* New command line option: --output-sync (-O) enables grouping of output by
|
||||||
target or by recursive make. This is useful during parallel builds to avoid
|
target or by recursive make. This is useful during parallel builds to avoid
|
||||||
mixing output from different jobs together giving hard-to-understand
|
mixing output from different jobs together giving hard-to-understand
|
||||||
@ -36,6 +30,14 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
|
|||||||
Reworked and enhanced by Frank Heckenbach <f.heckenbach@fh-soft.de>.
|
Reworked and enhanced by Frank Heckenbach <f.heckenbach@fh-soft.de>.
|
||||||
Windows support by Eli Zaretskii <eliz@gnu.org>.
|
Windows support by Eli Zaretskii <eliz@gnu.org>.
|
||||||
|
|
||||||
|
* New command line option: --trace enables tracing of targets. When enabled
|
||||||
|
the recipe to be invoked is printed even if it would otherwise be suppressed
|
||||||
|
by .SILENT or a "@" prefix character. Also before each recipe is run the
|
||||||
|
makefile name and linenumber where it was defined are shown as well as the
|
||||||
|
prerequisites that caused the target to be considered out of date. If the
|
||||||
|
"dir" option argument is given, it will display directory enter/leave
|
||||||
|
logging around each block of synchronized output.
|
||||||
|
|
||||||
* New feature: The "job server" capability is now supported on Windows.
|
* New feature: The "job server" capability is now supported on Windows.
|
||||||
Implementation contributed by Troy Runkel <Troy.Runkel@mathworks.com>
|
Implementation contributed by Troy Runkel <Troy.Runkel@mathworks.com>
|
||||||
|
|
||||||
@ -67,6 +69,11 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
|
|||||||
|
|
||||||
* New function: $(file ...) writes to a file.
|
* New function: $(file ...) writes to a file.
|
||||||
|
|
||||||
|
* New variable: $(GNUMAKEFLAGS) will be parsed for make flags, just like
|
||||||
|
MAKEFLAGS is. It can be set in the environment or the makefile, containing
|
||||||
|
GNU make-specific flags to allow your makefile to be portable to other
|
||||||
|
versions of make. GNU make never sets or modifies GNUMAKEFLAGS.
|
||||||
|
|
||||||
* On failure, the makefile name and linenumber of the recipe that failed are
|
* On failure, the makefile name and linenumber of the recipe that failed are
|
||||||
shown.
|
shown.
|
||||||
|
|
||||||
|
@ -525,6 +525,8 @@ static const char *default_variables[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !VMS */
|
#endif /* !VMS */
|
||||||
|
/* Make this assignment to avoid undefined variable warnings. */
|
||||||
|
"GNUMAKEFLAGS", "",
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4798,6 +4798,16 @@ itself. For instance, the @samp{-t}, @samp{-n}, and @samp{-q} options, if
|
|||||||
put in one of these variables, could have disastrous consequences and would
|
put in one of these variables, could have disastrous consequences and would
|
||||||
certainly have at least surprising and probably annoying effects.@refill
|
certainly have at least surprising and probably annoying effects.@refill
|
||||||
|
|
||||||
|
If you'd like to run other implementations of @code{make} in addition
|
||||||
|
to GNU @code{make}, and hence do not want to add GNU
|
||||||
|
@code{make}-specific flags to the @code{MAKEFLAGS} variable, you can
|
||||||
|
add them to the @code{GNUMAKEFLAGS} variable instead. This variable
|
||||||
|
is parsed just before @code{MAKEFLAGS}, in the same way as
|
||||||
|
@code{MAKEFLAGS}. Note, however, that when @code{make} constructs
|
||||||
|
@code{MAKEFLAGS} to pass to a recursive @code{make} it will include
|
||||||
|
all flags. GNU @code{make} never sets the @code{GNUMAKEFLAGS}
|
||||||
|
variable itself.
|
||||||
|
|
||||||
@node -w Option, , Options/Recursion, Recursion
|
@node -w Option, , Options/Recursion, Recursion
|
||||||
@subsection The @samp{--print-directory} Option
|
@subsection The @samp{--print-directory} Option
|
||||||
@cindex directories, printing them
|
@cindex directories, printing them
|
||||||
@ -11968,6 +11978,16 @@ recipe line: its contents may not be quoted correctly for use in the
|
|||||||
shell. Always allow recursive @code{make}'s to obtain these values
|
shell. Always allow recursive @code{make}'s to obtain these values
|
||||||
through the environment from its parent.
|
through the environment from its parent.
|
||||||
|
|
||||||
|
@item GNUMAKEFLAGS
|
||||||
|
|
||||||
|
Other flags parsed by @code{make}. You can set this in the environment or
|
||||||
|
a makefile to set @code{make} command-line flags. GNU @code{make}
|
||||||
|
never sets this variable itself. This variable is only needed if
|
||||||
|
you'd like to set GNU @code{make}-specific flags in a POSIX-compliant
|
||||||
|
makefile. This variable will be seen by GNU @code{make} and ignored
|
||||||
|
by other @code{make} implementations. It's not needed if you only use
|
||||||
|
GNU @code{make}; just use @code{MAKEFLAGS} directly.
|
||||||
|
|
||||||
@item MAKECMDGOALS
|
@item MAKECMDGOALS
|
||||||
|
|
||||||
The targets given to @code{make} on the command line. Setting this
|
The targets given to @code{make} on the command line. Setting this
|
||||||
|
3
main.c
3
main.c
@ -1339,7 +1339,9 @@ main (int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
/* Decode the switches. */
|
/* Decode the switches. */
|
||||||
|
|
||||||
|
decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
|
||||||
decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
|
decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* People write things like:
|
/* People write things like:
|
||||||
MFLAGS="CC=gcc -pipe" "CFLAGS=-g"
|
MFLAGS="CC=gcc -pipe" "CFLAGS=-g"
|
||||||
@ -1766,6 +1768,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
#endif /* __MSDOS__ || __EMX__ */
|
#endif /* __MSDOS__ || __EMX__ */
|
||||||
|
|
||||||
/* Decode switches again, in case the variables were set by the makefile. */
|
/* Decode switches again, in case the variables were set by the makefile. */
|
||||||
|
decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
|
||||||
decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
|
decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
|
||||||
#if 0
|
#if 0
|
||||||
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
|
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
|
||||||
|
24
tests/scripts/variables/GNUMAKEFLAGS
Normal file
24
tests/scripts/variables/GNUMAKEFLAGS
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*-perl-*-
|
||||||
|
|
||||||
|
$description = "Test proper behavior of GNUMAKEFLAGS";
|
||||||
|
|
||||||
|
# Accept flags from GNUMAKEFLAGS as well as MAKEFLAGS
|
||||||
|
# Results always go in MAKEFLAGS
|
||||||
|
|
||||||
|
$extraENV{'GNUMAKEFLAGS'} = '-e -r -R';
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
all: ; @echo $(MAKEFLAGS)
|
||||||
|
!,
|
||||||
|
'', 'Rre');
|
||||||
|
|
||||||
|
# Long arguments mean everything is prefixed with "-"
|
||||||
|
|
||||||
|
$extraENV{'GNUMAKEFLAGS'} = '--no-print-directory -e -r -R --trace=none --trace=dir';
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
all: ; @echo $(MAKEFLAGS)
|
||||||
|
!,
|
||||||
|
'', '--no-print-directory --trace=none --trace=dir --trace=none --trace=dir -Rre');
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in New Issue
Block a user