Hi, This patch allows a GNUMAKEFLAGS environment variable to override MAKEFLAGS. The reason for this is because Microsoft's nmake also uses MAKEFLAGS and this could potentially cause a conflict on hosts with multiple development environments.
I expect that this isn't the most elegant way to implement this but it is fairly modular at least. I basically guessed at the Amiga part since I don't have that machine handy. I didn't realize it initially but getenv/putenv don't modify the environment within the processes address space once the program is executing hence the mangling of the envp[] array. cheers, Kris --- main.c.old 2002-08-09 21:27:17.000000000 -0400 +++ main.c 2003-07-08 10:19:38.000000000 -0400 @@ -841,6 +841,7 @@ 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,33 @@ 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]){ +#ifndef _AMIGA + int i = 0; + while(envp[i]){ + if(strncmp(envp[i], "MAKEFLAGS", 9) == 0){ + /* Mangle MAKEFLAGS so the GNUMAKEFLAGS takes precedence. */ + sprintf(envp[i],"M4KEF14G5=%s",envp[i] + 10); + } + else if(strncmp(envp[i], "GNUMAKEFLAGS", 12) == 0){ + char *tmp = strdup(envp[i] + 3); + envp[i] = tmp; + putenv(tmp); + } + i++; + } +#else + /* Sufficient for Amiga's ENV: device? */ + char tmp[1024]; + sprintf(tmp, "MAKEFLAGS=%s", gmf); + putenv(strdup(tmp)); +#endif + putenv("GNUMAKEFLAGS="); + } + default_goal_file = 0; reading_file = 0;
main.c.diff
Description: Binary data
_______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make