Author: obrien
Date: Tue Mar 24 00:07:17 2009
New Revision: 190345
URL: http://svn.freebsd.org/changeset/base/190345

Log:
  MFC:
  r187475: Remove inlining of functions that are used mostly in different
         object files.  This lets use to remove NO_WERROR.
  r186558: Consistently use Var_SetGlobal().
  r186713: Add the -Q be-quiet flag for parallel jobs.
  r186279: Exit with error code 2 when run with -k (continue if errors)
         and build failed.
  r186559: Add the ability to tweak the token output before targets in job mode.
  r181021: Add POSIX -p flag to make(1).
  r186502: Clarify the behaviour of conditionals when dealing with comparisons.

Modified:
  stable/7/usr.bin/make/Makefile
  stable/7/usr.bin/make/buf.c
  stable/7/usr.bin/make/for.c
  stable/7/usr.bin/make/globals.h
  stable/7/usr.bin/make/job.c
  stable/7/usr.bin/make/job.h
  stable/7/usr.bin/make/main.c
  stable/7/usr.bin/make/make.1
  stable/7/usr.bin/make/make.c
  stable/7/usr.bin/make/make.h
  stable/7/usr.bin/make/parse.c
  stable/7/usr.bin/make/suff.c
  stable/7/usr.bin/make/var.c

Modified: stable/7/usr.bin/make/Makefile
==============================================================================
--- stable/7/usr.bin/make/Makefile      Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/Makefile      Tue Mar 24 00:07:17 2009        
(r190345)
@@ -8,7 +8,6 @@ SRCS=   arch.c buf.c cond.c dir.c for.c ha
        lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c  \
        util.c var.c
 
-NO_WERROR=
 WARNS?=        6
 NO_SHARED?=    YES
 
@@ -52,7 +51,7 @@ hash:
          echo ' * DO NOT EDIT' ;                                       \
          echo ' * $$''FreeBSD$$' ;                                     \
          echo -n ' * auto-generated from ' ;                           \
-         sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p'               \
+         sed -nEe '/\$$FreeBSD$/\1/p'          \
                ${.CURDIR}/parse.c ;                                    \
          echo ' * DO NOT EDIT' ;                                       \
          echo ' */' ;                                                  \

Modified: stable/7/usr.bin/make/buf.c
==============================================================================
--- stable/7/usr.bin/make/buf.c Mon Mar 23 23:43:07 2009        (r190344)
+++ stable/7/usr.bin/make/buf.c Tue Mar 24 00:07:17 2009        (r190345)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
  * Returns the number of bytes in the buffer.  Doesn't include the
  * null-terminating byte.
  */
-inline size_t
+size_t
 Buf_Size(const Buffer *buf)
 {
 
@@ -70,7 +70,7 @@ Buf_Size(const Buffer *buf)
  *  
  * @note Adding data to the Buffer object may invalidate the reference.
  */
-inline char *
+char *
 Buf_Data(const Buffer *bp)
 {
 
@@ -98,7 +98,7 @@ BufExpand(Buffer *bp, size_t nb)
 /**
  * Add a single byte to the buffer.
  */
-inline void
+void
 Buf_AddByte(Buffer *bp, Byte byte)
 {
 

Modified: stable/7/usr.bin/make/for.c
==============================================================================
--- stable/7/usr.bin/make/for.c Mon Mar 23 23:43:07 2009        (r190344)
+++ stable/7/usr.bin/make/for.c Tue Mar 24 00:07:17 2009        (r190345)
@@ -254,7 +254,7 @@ For_Run(int lineno)
 
        LST_FOREACH(ln, &values) {
                val = Lst_Datum(ln);
-               Var_Set(var, val, VAR_GLOBAL);
+               Var_SetGlobal(var, val);
 
                DEBUGF(FOR, ("--- %s = %s\n", var, val));
                str = Buf_Peel(Var_SubstOnly(var, Buf_Data(buf), FALSE));

Modified: stable/7/usr.bin/make/globals.h
==============================================================================
--- stable/7/usr.bin/make/globals.h     Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/globals.h     Tue Mar 24 00:07:17 2009        
(r190345)
@@ -70,11 +70,13 @@ extern struct Path parseIncPath;
 extern struct Path sysIncPath;
 
 extern int     jobLimit;       /* -j argument: maximum number of jobs */
+extern int     makeErrors;     /* Number of targets not remade due to errors */
 extern Boolean jobsRunning;    /* True if jobs are running */
 extern Boolean compatMake;     /* True if we are make compatible */
 extern Boolean ignoreErrors;   /* True if should ignore all errors */
 extern Boolean beSilent;       /* True if should print no commands */
 extern Boolean beVerbose;      /* True if should print extra cruft */
+extern Boolean beQuiet;        /* True if want quiet headers with -j */
 extern Boolean noExecute;      /* True if should execute nothing */
 extern Boolean allPrecious;    /* True if every target is precious */
 extern Boolean is_posix;       /* .POSIX target seen */

Modified: stable/7/usr.bin/make/job.c
==============================================================================
--- stable/7/usr.bin/make/job.c Mon Mar 23 23:43:07 2009        (r190344)
+++ stable/7/usr.bin/make/job.c Tue Mar 24 00:07:17 2009        (r190345)
@@ -263,7 +263,6 @@ TAILQ_HEAD(JobList, Job);
 /*
  * error handling variables
  */
-static int     errors = 0;     /* number of errors reported */
 static int     aborting = 0;   /* why is the make aborting? */
 #define        ABORT_ERROR     1       /* Because of an error */
 #define        ABORT_INTERRUPT 2       /* Because it was interrupted */
@@ -322,10 +321,11 @@ static GNode      *lastNode;      /* The node for 
 static const char *targFmt;    /* Format string to use to head output from a
                                 * job when it's not the most-recent job heard
                                 * from */
+static char *targPrefix = NULL;        /* What we print at the start of 
targFmt */
 
-#define        TARG_FMT  "--- %s ---\n" /* Default format */
+#define TARG_FMT  "%s %s ---\n"        /* Default format */
 #define        MESSAGE(fp, gn) \
-        fprintf(fp, targFmt, gn->name);
+       fprintf(fp, targFmt, targPrefix, gn->name);
 
 /*
  * When JobStart attempts to run a job but isn't allowed to
@@ -844,7 +844,7 @@ JobClose(Job *job)
  *
  *     If we got an error and are aborting (aborting == ABORT_ERROR) and
  *     the job list is now empty, we are done for the day.
- *     If we recognized an error (errors !=0), we set the aborting flag
+ *     If we recognized an error (makeErrors !=0), we set the aborting flag
  *     to ABORT_ERROR so no more jobs will be started.
  */
 static void
@@ -1119,7 +1119,7 @@ JobFinish(Job *job, int *status)
                free(job);
 
        } else if (*status != 0) {
-               errors += 1;
+               makeErrors++;
                free(job);
        }
 
@@ -1128,7 +1128,7 @@ JobFinish(Job *job, int *status)
        /*
         * Set aborting if any error.
         */
-       if (errors && !keepgoing && aborting != ABORT_INTERRUPT) {
+       if (makeErrors && !keepgoing && aborting != ABORT_INTERRUPT) {
                /*
                 * If we found any errors in this batch of children and the -k
                 * flag wasn't given, we set the aborting flag so no more jobs
@@ -1141,7 +1141,7 @@ JobFinish(Job *job, int *status)
                /*
                 * If we are aborting and the job table is now empty, we finish.
                 */
-               Finish(errors);
+               Finish(makeErrors);
        }
 }
 
@@ -2279,6 +2279,18 @@ Job_Make(GNode *gn)
        JobStart(gn, 0, NULL);
 }
 
+void
+Job_SetPrefix(void)
+{
+
+       if (targPrefix) {
+               free(targPrefix);
+       } else if (!Var_Exists(MAKE_JOB_PREFIX, VAR_GLOBAL)) {
+               Var_SetGlobal(MAKE_JOB_PREFIX, "---");
+       }
+       targPrefix = Var_Subst("${" MAKE_JOB_PREFIX "}", VAR_GLOBAL, 0)->buf;
+}
+
 /**
  * Job_Init
  *     Initialize the process module, given a maximum number of jobs.
@@ -2342,11 +2354,10 @@ Job_Init(int maxproc)
        nJobs = 0;
 
        aborting = 0;
-       errors = 0;
+       makeErrors = 0;
 
        lastNode = NULL;
-
-       if ((maxJobs == 1 && fifoFd < 0) || beVerbose == 0) {
+       if ((maxJobs == 1 && fifoFd < 0) || !beVerbose || is_posix || beQuiet) {
                /*
                 * If only one job can run at a time, there's no need for a
                 * banner, no is there?
@@ -2534,14 +2545,14 @@ JobInterrupt(int runINTERRUPT, int signo
  *     attached to the .END target.
  *
  * Results:
- *     Number of errors reported.
+ *     None.
  */
-int
+void
 Job_Finish(void)
 {
 
        if (postCommands != NULL && !Lst_IsEmpty(&postCommands->commands)) {
-               if (errors) {
+               if (makeErrors) {
                        Error("Errors reported so .END ignored");
                } else {
                        JobStart(postCommands, JOB_SPECIAL | JOB_IGNDOTS, NULL);
@@ -2558,7 +2569,6 @@ Job_Finish(void)
                if (fifoMaster)
                        unlink(fifoName);
        }
-       return (errors);
 }
 
 /**
@@ -3322,7 +3332,6 @@ void
 Compat_Run(Lst *targs)
 {
        GNode   *gn = NULL;     /* Current root target */
-       int     error_cnt;              /* Number of targets not remade due to 
errors */
        LstNode *ln;
 
        Compat_InstallSignalHandlers();
@@ -3355,7 +3364,7 @@ Compat_Run(Lst *targs)
         *      ABORTED   gn was not remade because one of its inferiors
         *                could not be made due to errors.
         */
-       error_cnt = 0;
+       makeErrors = 0;
        while (!Lst_IsEmpty(targs)) {
                gn = Lst_DeQueue(targs);
                Compat_Make(gn, gn);
@@ -3365,18 +3374,17 @@ Compat_Run(Lst *targs)
                } else if (gn->made == ABORTED) {
                        printf("`%s' not remade because of errors.\n",
                            gn->name);
-                       error_cnt += 1;
+                       makeErrors++;
                }
        }
 
        /*
         * If the user has defined a .END target, run its commands.
         */
-       if (error_cnt == 0) {
+       if (makeErrors == 0) {
                LST_FOREACH(ln, &ENDNode->commands) {
                        if (Compat_RunCommand(Lst_Datum(ln), ENDNode))
                                break;
                }
        }
 }
-

Modified: stable/7/usr.bin/make/job.h
==============================================================================
--- stable/7/usr.bin/make/job.h Mon Mar 23 23:43:07 2009        (r190344)
+++ stable/7/usr.bin/make/job.h Tue Mar 24 00:07:17 2009        (r190345)
@@ -64,9 +64,10 @@ void Job_Make(struct GNode *);
 void Job_Init(int);
 Boolean Job_Full(void);
 Boolean Job_Empty(void);
-int Job_Finish(void);
+void Job_Finish(void);
 void Job_Wait(void);
 void Job_AbortAll(void);
+void Job_SetPrefix(void);
 
 void Proc_Init(void);
 

Modified: stable/7/usr.bin/make/main.c
==============================================================================
--- stable/7/usr.bin/make/main.c        Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/main.c        Tue Mar 24 00:07:17 2009        
(r190345)
@@ -126,13 +126,16 @@ Boolean           is_posix;       /* .POSIX target seen
 Boolean                mfAutoDeps;     /* .MAKEFILEDEPS target seen */
 Boolean                beSilent;       /* -s flag */
 Boolean                beVerbose;      /* -v flag */
+Boolean                beQuiet;        /* -Q flag */
 Boolean                compatMake;     /* -B argument */
 int            debug;          /* -d flag */
 Boolean                ignoreErrors;   /* -i flag */
 int            jobLimit;       /* -j argument */
+int            makeErrors;     /* Number of targets not remade due to errors */
 Boolean                jobsRunning;    /* TRUE if the jobs might be running */
 Boolean                keepgoing;      /* -k flag */
 Boolean                noExecute;      /* -n flag */
+Boolean                printGraphOnly; /* -p flag */
 Boolean                queryFlag;      /* -q flag */
 Boolean                touchFlag;      /* -t flag */
 Boolean                usePipes;       /* !-P flag */
@@ -150,7 +153,7 @@ static void
 usage(void)
 {
        fprintf(stderr,
-           "usage: make [-BPSXeiknqrstv] [-C directory] [-D variable]\n"
+           "usage: make [-BPSXeiknpqrstv] [-C directory] [-D variable]\n"
            "\t[-d flags] [-E variable] [-f makefile] [-I directory]\n"
            "\t[-j max_jobs] [-m directory] [-V variable]\n"
            "\t[variable=value] [target ...]\n");
@@ -368,7 +371,7 @@ MainParseArgs(int argc, char **argv)
 rearg:
        optind = 1;     /* since we're called more than once */
        optreset = 1;
-#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
+#define OPTFLAGS "ABC:D:d:E:ef:I:ij:km:nPpQqrSstV:vXx:"
        for (;;) {
                if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
                        found_dd = TRUE;
@@ -382,6 +385,11 @@ rearg:
                        arch_fatal = FALSE;
                        MFLAGS_append("-A", NULL);
                        break;
+               case 'B':
+                       compatMake = TRUE;
+                       MFLAGS_append("-B", NULL);
+                       unsetenv("MAKE_JOBS_FIFO");
+                       break;
                case 'C':
                        if (chdir(optarg) == -1)
                                err(1, "chdir %s", optarg);
@@ -390,30 +398,6 @@ rearg:
                        Var_SetGlobal(optarg, "1");
                        MFLAGS_append("-D", optarg);
                        break;
-               case 'I':
-                       Parse_AddIncludeDir(optarg);
-                       MFLAGS_append("-I", optarg);
-                       break;
-               case 'V':
-                       Lst_AtEnd(&variables, estrdup(optarg));
-                       MFLAGS_append("-V", optarg);
-                       break;
-               case 'X':
-                       expandVars = FALSE;
-                       break;
-               case 'B':
-                       compatMake = TRUE;
-                       MFLAGS_append("-B", NULL);
-                       unsetenv("MAKE_JOBS_FIFO");
-                       break;
-               case 'P':
-                       usePipes = FALSE;
-                       MFLAGS_append("-P", NULL);
-                       break;
-               case 'S':
-                       keepgoing = FALSE;
-                       MFLAGS_append("-S", NULL);
-                       break;
                case 'd': {
                        char *modules = optarg;
 
@@ -481,6 +465,10 @@ rearg:
                case 'f':
                        Lst_AtEnd(&makefiles, estrdup(optarg));
                        break;
+               case 'I':
+                       Parse_AddIncludeDir(optarg);
+                       MFLAGS_append("-I", optarg);
+                       break;
                case 'i':
                        ignoreErrors = TRUE;
                        MFLAGS_append("-i", NULL);
@@ -510,6 +498,19 @@ rearg:
                        noExecute = TRUE;
                        MFLAGS_append("-n", NULL);
                        break;
+               case 'P':
+                       usePipes = FALSE;
+                       MFLAGS_append("-P", NULL);
+                       break;
+               case 'p':
+                       printGraphOnly = TRUE;
+                       debug |= DEBUG_GRAPH1;
+                       break;
+               case 'Q':
+                       beQuiet = TRUE;
+                       beVerbose = FALSE;
+                       MFLAGS_append("-Q", NULL);
+                       break;
                case 'q':
                        queryFlag = TRUE;
                        /* Kind of nonsensical, wot? */
@@ -519,6 +520,10 @@ rearg:
                        noBuiltins = TRUE;
                        MFLAGS_append("-r", NULL);
                        break;
+               case 'S':
+                       keepgoing = FALSE;
+                       MFLAGS_append("-S", NULL);
+                       break;
                case 's':
                        beSilent = TRUE;
                        MFLAGS_append("-s", NULL);
@@ -527,10 +532,18 @@ rearg:
                        touchFlag = TRUE;
                        MFLAGS_append("-t", NULL);
                        break;
+               case 'V':
+                       Lst_AtEnd(&variables, estrdup(optarg));
+                       MFLAGS_append("-V", optarg);
+                       break;
                case 'v':
                        beVerbose = TRUE;
+                       beQuiet = FALSE;
                        MFLAGS_append("-v", NULL);
                        break;
+               case 'X':
+                       expandVars = FALSE;
+                       break;
                case 'x':
                        if (Main_ParseWarn(optarg, 1) != -1)
                                MFLAGS_append("-x", optarg);
@@ -903,6 +916,7 @@ main(int argc, char **argv)
        beSilent = FALSE;               /* Print commands as executed */
        ignoreErrors = FALSE;           /* Pay attention to non-zero returns */
        noExecute = FALSE;              /* Execute all commands */
+       printGraphOnly = FALSE;         /* Don't stop after printing graph */
        keepgoing = FALSE;              /* Stop on error */
        allPrecious = FALSE;            /* Remove targets when interrupted */
        queryFlag = FALSE;              /* This is not just a check-run */
@@ -933,14 +947,13 @@ main(int argc, char **argv)
 #endif
 
        /*
-        * FreeBSD/pc98 kernel used to set the utsname.machine to
-        * "i386", and MACHINE was defined as "i386", so it could
-        * not be distinguished from FreeBSD/i386.  Therefore, we
-        * had to check machine.ispc98 and adjust the MACHINE
-        * variable.
-        * NOTE: The code is still here to be able to compile new
-        * make binary on old FreeBSD/pc98 systems, and have the
-        * MACHINE variable set properly.
+        * Prior to 7.0, FreeBSD/pc98 kernel used to set the
+        * utsname.machine to "i386", and MACHINE was defined as
+        * "i386", so it could not be distinguished from FreeBSD/i386.
+        * Therefore, we had to check machine.ispc98 and adjust the
+        * MACHINE variable.  NOTE: The code is still here to be able
+        * to compile new make binary on old FreeBSD/pc98 systems, and
+        * have the MACHINE variable set properly.
         */
        if ((machine = getenv("MACHINE")) == NULL) {
                int     ispc98;
@@ -1023,6 +1036,16 @@ main(int argc, char **argv)
 #ifdef MAKE_VERSION
        Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
 #endif
+       Var_SetGlobal(".newline", "\n");        /* handy for :@ loops */
+       {
+               char tmp[64];
+
+               snprintf(tmp, sizeof(tmp), "%u", getpid());
+               Var_SetGlobal(".MAKE.PID", tmp);
+               snprintf(tmp, sizeof(tmp), "%u", getppid());
+               Var_SetGlobal(".MAKE.PPID", tmp);
+       }
+       Job_SetPrefix();
 
        /*
         * First snag things out of the MAKEFLAGS environment
@@ -1243,7 +1266,7 @@ main(int argc, char **argv)
                Targ_PrintGraph(1);
 
        /* print the values of any variables requested by the user */
-       if (Lst_IsEmpty(&variables)) {
+       if (Lst_IsEmpty(&variables) && !printGraphOnly) {
                /*
                 * Since the user has not requested that any variables
                 * be printed, we can build targets.
@@ -1306,9 +1329,11 @@ main(int argc, char **argv)
        if (DEBUG(GRAPH2))
                Targ_PrintGraph(2);
 
-       if (queryFlag && outOfDate)
-               return (1);
-       else
-               return (0);
-}
+       if (queryFlag)
+               return (outOfDate);
 
+       if (makeErrors != 0)
+               Finish(makeErrors);
+
+       return (0);
+}

Modified: stable/7/usr.bin/make/make.1
==============================================================================
--- stable/7/usr.bin/make/make.1        Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/make.1        Tue Mar 24 00:07:17 2009        
(r190345)
@@ -32,7 +32,7 @@
 .\"    @(#)make.1      8.8 (Berkeley) 6/13/95
 .\" $FreeBSD$
 .\"
-.Dd March 24, 2008
+.Dd December 29, 2008
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd maintain program dependencies
 .Sh SYNOPSIS
 .Nm
-.Op Fl ABPSXeiknqrstv
+.Op Fl ABPSXeiknpqrstv
 .Op Fl C Ar directory
 .Op Fl D Ar variable
 .Op Fl d Ar flags
@@ -249,6 +249,18 @@ instead of mixing the output of parallel
 This option has no effect unless
 .Fl j
 is used too.
+.It Fl p
+Only print the input graph, not executing any commands.
+The output is the same as
+.Fl d Ar g1 .
+When combined with
+.Fl f Pa /dev/null ,
+only the builtin rules of
+.Nm
+are displayed.
+.It Fl Q
+Be extra quiet.
+For multi-job makes, this will cause file banners not to be generated.
 .It Fl q
 Do not execute any commands, but exit 0 if the specified targets are
 up-to-date and 1, otherwise.
@@ -280,7 +292,7 @@ the variables will be printed one per li
 with a blank line for each null or undefined variable.
 .It Fl v
 Be extra verbose.
-For multi-job makes, this will cause file banners to be generated.
+Print any extra information.
 .It Fl X
 When using the
 .Fl V
@@ -754,6 +766,31 @@ contains all the options from the
 environment variable plus any options specified on
 .Nm Ns 's
 command line.
+.It Va .MAKE.PID
+The process-id of
+.Nm .
+.It Va .MAKE.PPID
+The parent process-id of
+.Nm .
+.It Va .MAKE.JOB.PREFIX
+If
+.Nm
+is run with
+.Fl j Fl v
+then output for each target is prefixed with a token
+.Ql --- target ---
+the first part of which can be controlled via
+.Va .MAKE.JOB.PREFIX .
+.br
+For example:
+.Li .MAKE.JOB.PREFIX=${.newline}---${MAKE:T}[${.MAKE.PID}]
+would produce tokens like
+.Ql ---make[1234] target ---
+or
+.Li .MAKE.JOB.PREFIX=---pid[${.MAKE.PID}],ppid[${.MAKE.PPID}]
+would produce tokens like
+.Ql ---pid[56789],ppid[1234] target ---
+making it easier to track the degree of parallelism being achieved.
 .It Va .TARGETS
 List of targets
 .Nm
@@ -1121,24 +1158,34 @@ has been defined.
 .Pp
 An
 .Ar expression
-may also be an arithmetic or string comparison, with the left-hand side
-being a variable expansion.
-Variable expansion is
-performed on both sides of the comparison, after which the integral
+may also be a numeric or string comparison:
+in this case, the left-hand side
+.Ar must be
+a variable expansion, whereas the right-hand side can be a
+constant or a variable expansion.
+Variable expansion is performed on both sides, after which the resulting
 values are compared.
 A value is interpreted as hexadecimal if it is
 preceded by 0x, otherwise it is decimal; octal numbers are not supported.
-The standard C relational operators are all supported.
-If after
-variable expansion, either the left or right hand side of a
+.Pp
+String comparison can only use the
 .Sq Ic ==
 or
 .Sq Ic !=
-operator is not an integral value, then
-string comparison is performed between the expanded
-variables.
-If no relational operator is given, it is assumed that the expanded
-variable is being compared against 0.
+operators, whereas numeric values (both integer and floating point)
+can also be compared using the
+.Sq Ic > ,
+.Sq Ic >= ,
+.Sq Ic <
+and
+.Sq Ic <=
+operators.
+.Pp
+If no relational operator (and right-hand value) are given, an implicit
+.Sq Ic != 0
+is used.
+However be very careful in using this feature especially
+when the left-hand side variable expansion returns a string.
 .Pp
 When
 .Nm

Modified: stable/7/usr.bin/make/make.c
==============================================================================
--- stable/7/usr.bin/make/make.c        Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/make.c        Tue Mar 24 00:07:17 2009        
(r190345)
@@ -713,7 +713,6 @@ Make_Run(Lst *targs)
        GNode   *gn;            /* a temporary pointer */
        GNode   *cgn;
        Lst     examine;        /* List of targets to examine */
-       int     errors;         /* Number of errors the Job module reports */
        LstNode *ln;
 
        Lst_Init(&examine);
@@ -793,15 +792,14 @@ Make_Run(Lst *targs)
                MakeStartJobs();
        }
 
-       errors = Job_Finish();
+       Job_Finish();
 
        /*
         * Print the final status of each target. E.g. if it wasn't made
         * because some inferior reported an error.
         */
-       errors = ((errors == 0) && (numNodes != 0));
        LST_FOREACH(ln, targs)
-               MakePrintStatus(Lst_Datum(ln), errors);
+               MakePrintStatus(Lst_Datum(ln), (makeErrors == 0) && (numNodes 
!= 0));
 
        return (TRUE);
 }

Modified: stable/7/usr.bin/make/make.h
==============================================================================
--- stable/7/usr.bin/make/make.h        Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/make.h        Tue Mar 24 00:07:17 2009        
(r190345)
@@ -49,6 +49,8 @@
 
 #include "util.h"
 
+#define        MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
+
 struct GNode;
 struct Lst;
 struct Buffer;

Modified: stable/7/usr.bin/make/parse.c
==============================================================================
--- stable/7/usr.bin/make/parse.c       Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/parse.c       Tue Mar 24 00:07:17 2009        
(r190345)
@@ -1076,7 +1076,7 @@ ParseDoDependency(char *line)
                        break;
                  case Posix:
                        is_posix = TRUE;
-                       Var_Set("%POSIX", "1003.2", VAR_GLOBAL);
+                       Var_SetGlobal("%POSIX", "1003.2");
                        break;
                  default:
                        break;
@@ -1533,6 +1533,8 @@ Parse_DoVar(char *line, GNode *ctxt)
                 */
                Var_Set(line, cp, ctxt);
        }
+       if (strcmp(line, MAKE_JOB_PREFIX) == 0)
+               Job_SetPrefix();
 }
 
 /*-

Modified: stable/7/usr.bin/make/suff.c
==============================================================================
--- stable/7/usr.bin/make/suff.c        Mon Mar 23 23:43:07 2009        
(r190344)
+++ stable/7/usr.bin/make/suff.c        Tue Mar 24 00:07:17 2009        
(r190345)
@@ -514,6 +514,7 @@ Suff_AddTransform(char *line)
        Suff    *s;     /* source suffix */
        Suff    *t;     /* target suffix */
 
+       s = t = NULL;   /* silence gcc */
        gn = SuffTransFind(line);
        if (gn == NULL) {
                /*
@@ -785,11 +786,11 @@ Suff_DoPaths(void)
        }
 
        ptr = Path_MakeFlags("-I", &inIncludes);
-       Var_Set(".INCLUDES", ptr, VAR_GLOBAL);
+       Var_SetGlobal(".INCLUDES", ptr);
        free(ptr);
 
        ptr = Path_MakeFlags("-L", &inLibs);
-       Var_Set(".LIBS", ptr, VAR_GLOBAL);
+       Var_SetGlobal(".LIBS", ptr);
        free(ptr);
 
        Path_Clear(&inIncludes);

Modified: stable/7/usr.bin/make/var.c
==============================================================================
--- stable/7/usr.bin/make/var.c Mon Mar 23 23:43:07 2009        (r190344)
+++ stable/7/usr.bin/make/var.c Tue Mar 24 00:07:17 2009        (r190345)
@@ -946,12 +946,14 @@ VarFindAny(const char name[], GNode *ctx
  *     The name and val arguments are duplicated so they may
  *     safely be freed.
  */
-static void
+static Var *
 VarAdd(const char *name, const char *val, GNode *ctxt)
 {
+       Var *v;
 
-       Lst_AtFront(&ctxt->context, VarCreate(name, val, 0));
+       Lst_AtFront(&ctxt->context, v = VarCreate(name, val, 0));
        DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, name, val));
+       return (v);
 }
 
 /**
@@ -1004,30 +1006,22 @@ Var_Set(const char *name, const char *va
        n = VarPossiblyExpand(name, ctxt);
        v = VarFindOnly(n, ctxt);
        if (v == NULL) {
-               VarAdd(n, val, ctxt);
-               if (ctxt == VAR_CMD) {
-                       /*
-                        * Any variables given on the command line
-                        * are automatically exported to the
-                        * environment (as per POSIX standard)
-                        */
-                       setenv(n, val, 1);
-               }
+               v = VarAdd(n, val, ctxt);
        } else {
                Buf_Clear(v->val);
                Buf_Append(v->val, val);
-
-               if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
-                       /*
-                        * Any variables given on the command line
-                        * are automatically exported to the
-                        * environment (as per POSIX standard)
-                        */
-                       setenv(n, val, 1);
-               }
                DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, n, val));
        }
 
+       if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
+               /*
+                * Any variables given on the command line
+                * are automatically exported to the
+                * environment (as per POSIX standard)
+                */
+               setenv(n, val, 1);
+       }
+
        free(n);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to