summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2008-12-18 12:16:51 +0000
committerfjoe <fjoe@FreeBSD.org>2008-12-18 12:16:51 +0000
commit95c5b12c17caea660098332fcad5d02b98688e38 (patch)
treec1784caf6d6db98b1fc61e02c2bfffdfed661c9d /usr.bin
parent068931a9897e3bea2e9c192f392fe5548cbed6ce (diff)
downloadFreeBSD-src-95c5b12c17caea660098332fcad5d02b98688e38.zip
FreeBSD-src-95c5b12c17caea660098332fcad5d02b98688e38.tar.gz
Exit with error code 2 when run with -k (continue if errors) and build failed.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/globals.h1
-rw-r--r--usr.bin/make/job.c26
-rw-r--r--usr.bin/make/job.h2
-rw-r--r--usr.bin/make/main.c13
-rw-r--r--usr.bin/make/make.c6
5 files changed, 23 insertions, 25 deletions
diff --git a/usr.bin/make/globals.h b/usr.bin/make/globals.h
index 04c7da9..5e42a4a 100644
--- a/usr.bin/make/globals.h
+++ b/usr.bin/make/globals.h
@@ -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 */
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 77a7f86..7cc575e 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -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 */
@@ -849,7 +848,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
@@ -1124,7 +1123,7 @@ JobFinish(Job *job, int *status)
free(job);
} else if (*status != 0) {
- errors += 1;
+ makeErrors++;
free(job);
}
@@ -1133,7 +1132,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
@@ -1146,7 +1145,7 @@ JobFinish(Job *job, int *status)
/*
* If we are aborting and the job table is now empty, we finish.
*/
- Finish(errors);
+ Finish(makeErrors);
}
}
@@ -2347,7 +2346,7 @@ Job_Init(int maxproc)
nJobs = 0;
aborting = 0;
- errors = 0;
+ makeErrors = 0;
lastNode = NULL;
@@ -2539,14 +2538,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);
@@ -2563,7 +2562,6 @@ Job_Finish(void)
if (fifoMaster)
unlink(fifoName);
}
- return (errors);
}
/**
@@ -3327,7 +3325,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();
@@ -3360,7 +3357,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);
@@ -3370,18 +3367,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;
}
}
}
-
diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h
index a4c6620..57c99de 100644
--- a/usr.bin/make/job.h
+++ b/usr.bin/make/job.h
@@ -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);
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 7569d42..7ba0bae 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -130,6 +130,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 */
@@ -1311,9 +1312,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);
+}
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 4ac5bb6..835e855 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -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);
}
OpenPOWER on IntegriCloud