Index: globals.h =================================================================== RCS file: /home/ncvs/src/usr.bin/make/globals.h,v retrieving revision 1.11 diff -u -p -r1.11 globals.h --- globals.h 8 Mar 2007 09:16:10 -0000 1.11 +++ globals.h 23 Mar 2008 13:54:34 -0000 @@ -70,6 +70,7 @@ 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 */ Index: job.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/job.c,v retrieving revision 1.126 diff -u -p -r1.126 job.c --- job.c 8 Mar 2007 09:16:10 -0000 1.126 +++ job.c 23 Mar 2008 13:58:39 -0000 @@ -267,7 +267,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 */ @@ -848,7 +847,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 @@ -1123,7 +1122,7 @@ JobFinish(Job *job, int *status) free(job); } else if (*status != 0) { - errors += 1; + makeErrors++; free(job); } @@ -1132,7 +1131,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 @@ -1145,7 +1144,7 @@ JobFinish(Job *job, int *status) /* * If we are aborting and the job table is now empty, we finish. */ - Finish(errors); + Finish(makeErrors); } } @@ -2346,7 +2345,7 @@ Job_Init(int maxproc) nJobs = 0; aborting = 0; - errors = 0; + makeErrors = 0; lastNode = NULL; @@ -2538,14 +2537,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); @@ -2562,7 +2561,6 @@ Job_Finish(void) if (fifoMaster) unlink(fifoName); } - return (errors); } /** @@ -3326,7 +3324,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(); @@ -3359,7 +3356,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); @@ -3369,18 +3366,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; } } } - Index: job.h =================================================================== RCS file: /home/ncvs/src/usr.bin/make/job.h,v retrieving revision 1.46 diff -u -p -r1.46 job.h --- job.h 8 Mar 2007 09:16:10 -0000 1.46 +++ job.h 23 Mar 2008 13:58:27 -0000 @@ -64,7 +64,7 @@ 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); Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/main.c,v retrieving revision 1.163.2.1 diff -u -p -r1.163.2.1 main.c --- main.c 29 Nov 2007 04:20:19 -0000 1.163.2.1 +++ main.c 23 Mar 2008 14:07:45 -0000 @@ -129,6 +129,7 @@ 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 */ @@ -1303,9 +1304,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); +} Index: make.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/make.c,v retrieving revision 1.39 diff -u -p -r1.39 make.c --- make.c 20 Apr 2007 06:33:25 -0000 1.39 +++ make.c 23 Mar 2008 13:58:53 -0000 @@ -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); }