bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] allow GNUMAKEFLAGS override to MAKEFLAGS


From: Kris Warkentin
Subject: [RFC] allow GNUMAKEFLAGS override to MAKEFLAGS
Date: Mon, 23 Jun 2003 15:14:28 -0400

Microsoft's nmake command makes use of MAKEFLAGS as well which potentially
could create a problem with having GNU make and nmake co-exist on a system.

It seemed that having a GNUMAKEFLAGS environment variable to override
MAKEFLAGS would probably do the trick.  The logic would be:

1) At first invocation, check for GNUMAKEFLAGS.
2) If defined, set MAKEFLAGS to be the same as GNUMAKEFLAGS and clear
GNUMAKEFLAGS

Step two makes sure that if make invokes itself recursively, everything
works properly.  Based on my quick look at the code, it seems that make uses
the environment to pass things down the line but I could be wrong about
that.  I'm hoping someone can tell me why this seemingly simple patch
doesn't work.  I fell back on setenv("GNUMAKEFLAGS", "", 1) and then testing
for an empty string because setenv("blah", NULL, 1) didn't seem to do
anything on Cygwin.

cheers,

Kris

--- main.c 2002-08-09 21:27:17.000000000 -0400
+++ main.c.new 2003-06-23 15:01:54.000000000 -0400
@@ -841,6 +841,7 @@ int main (int argc, char ** argv)
   register struct file *f;
   register unsigned int i;
   char **p;
+  char *gmf;
   struct dep *read_makefiles;
   PATH_VAR (current_directory);
 #ifdef WINDOWS32
@@ -854,6 +855,14 @@ int main (int argc, char ** argv)
   no_default_sh_exe = 1;
 #endif

+  /* Allow GNUMAKEFLAGS to override MAKEFLAGS.  We unset it after the first
+     call so as to not override it on subsequent calls.  */
+  gmf = getenv("GNUMAKEFLAGS");
+  if(NULL != gmf && '\0' != gmf[0]){
+    setenv("MAKEFLAGS", gmf, 1);
+    setenv("GNUMAKEFLAGS", "", 1);
+  }
+
   default_goal_file = 0;
   reading_file = 0;







reply via email to

[Prev in Thread] Current Thread [Next in Thread]