Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Use a #define for the variable name we put in e...



details:   https://anonhg.NetBSD.org/src/rev/47c509e4fbab
branches:  trunk
changeset: 787452:47c509e4fbab
user:      sjg <sjg%NetBSD.org@localhost>
date:      Tue Jun 18 20:06:09 2013 +0000

description:
Use a #define for the variable name we put in environment to pass .MAKE.LEVEL
in case we don't want to use gmake's MAKELEVEL in a different way.

diffstat:

 usr.bin/make/main.c |   8 ++++----
 usr.bin/make/make.h |   5 ++++-
 usr.bin/make/var.c  |  12 ++++++------
 3 files changed, 14 insertions(+), 11 deletions(-)

diffs (108 lines):

diff -r 1834b47a1f96 -r 47c509e4fbab usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Jun 18 19:31:27 2013 +0000
+++ b/usr.bin/make/main.c       Tue Jun 18 20:06:09 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.213 2013/06/10 20:24:58 christos Exp $      */
+/*     $NetBSD: main.c,v 1.214 2013/06/18 20:06:09 sjg Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.213 2013/06/10 20:24:58 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.214 2013/06/18 20:06:09 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.213 2013/06/10 20:24:58 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.214 2013/06/18 20:06:09 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -940,7 +940,7 @@
            char tmp[64], *ep;
 
            snprintf(tmp, sizeof(tmp), "%d",
-               (ep = getenv("MAKELEVEL")) ? atoi(ep) + 1 : 0);
+               (ep = getenv(MAKE_LEVEL_ENV)) ? atoi(ep) + 1 : 0);
            Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL, 0);
            snprintf(tmp, sizeof(tmp), "%u", myPid);
            Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0);
diff -r 1834b47a1f96 -r 47c509e4fbab usr.bin/make/make.h
--- a/usr.bin/make/make.h       Tue Jun 18 19:31:27 2013 +0000
+++ b/usr.bin/make/make.h       Tue Jun 18 20:06:09 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.90 2013/02/25 01:57:14 dholland Exp $       */
+/*     $NetBSD: make.h,v 1.91 2013/06/18 20:06:09 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -426,6 +426,9 @@
 #define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
 #define MAKE_DEPENDFILE        ".MAKE.DEPENDFILE" /* .depend */
 #define MAKE_MODE      ".MAKE.MODE"
+#ifndef MAKE_LEVEL_ENV
+# define MAKE_LEVEL_ENV        "MAKELEVEL"
+#endif
 
 /*
  * debug control:
diff -r 1834b47a1f96 -r 47c509e4fbab usr.bin/make/var.c
--- a/usr.bin/make/var.c        Tue Jun 18 19:31:27 2013 +0000
+++ b/usr.bin/make/var.c        Tue Jun 18 20:06:09 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.178 2013/06/10 20:24:58 christos Exp $       */
+/*     $NetBSD: var.c,v 1.179 2013/06/18 20:06:09 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.178 2013/06/10 20:24:58 christos Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.179 2013/06/18 20:06:09 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.178 2013/06/10 20:24:58 christos Exp $");
+__RCSID("$NetBSD: var.c,v 1.179 2013/06/18 20:06:09 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -778,7 +778,7 @@
     if (unexport_env) {
        char **newenv;
 
-       cp = getenv("MAKELEVEL");       /* we should preserve this */
+       cp = getenv(MAKE_LEVEL_ENV);    /* we should preserve this */
        if (environ == savedEnv) {
            /* we have been here before! */
            newenv = bmake_realloc(environ, 2 * sizeof(char *));
@@ -795,7 +795,7 @@
        environ = savedEnv = newenv;
        newenv[0] = NULL;
        newenv[1] = NULL;
-       setenv("MAKELEVEL", cp, 1);
+       setenv(MAKE_LEVEL_ENV, cp, 1);
     } else {
        for (; *str != '\n' && isspace((unsigned char) *str); str++)
            continue;
@@ -961,7 +961,7 @@
      * children see a correctly incremented value.
      */
     if (ctxt == VAR_GLOBAL && strcmp(MAKE_LEVEL, name) == 0)
-       setenv("MAKELEVEL", val, 1);
+       setenv(MAKE_LEVEL_ENV, val, 1);
        
        
  out:



Home | Main Index | Thread Index | Old Index