diff options
-rw-r--r-- | usr.bin/make/globals.h | 1 | ||||
-rw-r--r-- | usr.bin/make/job.c | 7 | ||||
-rw-r--r-- | usr.bin/make/job.h | 2 | ||||
-rw-r--r-- | usr.bin/make/main.c | 9 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 2 |
5 files changed, 13 insertions, 8 deletions
diff --git a/usr.bin/make/globals.h b/usr.bin/make/globals.h index e23de1e..e6d1e65 100644 --- a/usr.bin/make/globals.h +++ b/usr.bin/make/globals.h @@ -69,6 +69,7 @@ extern struct Path parseIncPath; /* The system include path. */ extern struct Path sysIncPath; +extern int jobLimit; /* -j argument: maximum number of jobs */ 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 f5b555b..279fb66 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -400,7 +400,12 @@ static struct Shell *commandShell = NULL; static char *shellPath = NULL; /* full pathname of executable image */ static char *shellName = NULL; /* last component of shell */ -int maxJobs; /* The most children we can run at once */ +/* + * The maximum number of jobs that may run. This is initialize from the + * -j argument for the leading make and from the FIFO for sub-makes. + */ +static int maxJobs; + static int nJobs; /* The number of children currently running */ /* The structures that describe them */ diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h index 987b5fd..04253b8 100644 --- a/usr.bin/make/job.h +++ b/usr.bin/make/job.h @@ -56,8 +56,6 @@ struct Buffer; struct GNode; struct Lst; -extern int maxJobs; /* Number of jobs that may run */ - void Shell_Init(void); void Job_Touch(struct GNode *, Boolean); Boolean Job_CheckCommands(struct GNode *, void (*abortProc)(const char *, ...)); diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 5b45678..8e41fd8 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -122,6 +122,7 @@ static Boolean expandVars; /* fully expand printed variables */ static Lst variables = Lst_Initializer(variables); static Boolean forceJobs; /* -j argument given */ +int jobLimit; /* -j argument: maximum number of jobs */ Boolean compatMake; /* -B argument */ Boolean debug; /* -d flag */ Boolean noExecute; /* -n flag */ @@ -362,8 +363,8 @@ rearg: char *endptr; forceJobs = TRUE; - maxJobs = strtol(optarg, &endptr, 10); - if (maxJobs <= 0 || *endptr != '\0') { + jobLimit = strtol(optarg, &endptr, 10); + if (jobLimit <= 0 || *endptr != '\0') { warnx("illegal number, -j argument -- %s", optarg); usage(); @@ -695,7 +696,7 @@ main(int argc, char **argv) debug = 0; /* No debug verbosity, please. */ jobsRunning = FALSE; - maxJobs = DEFMAXJOBS; + jobLimit = DEFMAXJOBS; forceJobs = FALSE; /* No -j flag */ compatMake = FALSE; /* No compat mode */ @@ -977,7 +978,7 @@ main(int argc, char **argv) * should it exist). */ if (!queryFlag) { - Job_Init(maxJobs); + Job_Init(jobLimit); jobsRunning = TRUE; } diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 4df224f..219675f 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -882,7 +882,7 @@ ParseDoDependency(char *line) DEFAULT = gn; break; case NotParallel: - maxJobs = 1; + jobLimit = 1; break; case SingleShell: compatMake = 1; |