summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS19
-rw-r--r--default.c2
-rw-r--r--doc/make.texi20
-rw-r--r--main.c3
-rw-r--r--tests/scripts/variables/GNUMAKEFLAGS24
5 files changed, 62 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 621be57..2ecd66f 100644
--- a/NEWS
+++ b/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
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
target or by recursive make. This is useful during parallel builds to avoid
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>.
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.
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 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
shown.
diff --git a/default.c b/default.c
index 9f02dd4..4b24e2e 100644
--- a/default.c
+++ b/default.c
@@ -525,6 +525,8 @@ static const char *default_variables[] =
#endif
#endif /* !VMS */
+ /* Make this assignment to avoid undefined variable warnings. */
+ "GNUMAKEFLAGS", "",
0, 0
};
diff --git a/doc/make.texi b/doc/make.texi
index 8a35780..e3e5135 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -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
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
@subsection The @samp{--print-directory} Option
@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
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
The targets given to @code{make} on the command line. Setting this
diff --git a/main.c b/main.c
index f3c4a3d..8eed56d 100644
--- a/main.c
+++ b/main.c
@@ -1339,7 +1339,9 @@ main (int argc, char **argv, char **envp)
/* Decode the switches. */
+ decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
decode_env_switches (STRING_SIZE_TUPLE ("MAKEFLAGS"));
+
#if 0
/* People write things like:
MFLAGS="CC=gcc -pipe" "CFLAGS=-g"
@@ -1766,6 +1768,7 @@ main (int argc, char **argv, char **envp)
#endif /* __MSDOS__ || __EMX__ */
/* 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"));
#if 0
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
diff --git a/tests/scripts/variables/GNUMAKEFLAGS b/tests/scripts/variables/GNUMAKEFLAGS
new file mode 100644
index 0000000..7bfd822
--- /dev/null
+++ b/tests/scripts/variables/GNUMAKEFLAGS
@@ -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;