| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $ */ | | 1 | /* $NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | | 4 | * Copyright (c) 1988, 1989, 1990, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Adam de Boor. | | 8 | * Adam de Boor. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -108,27 +108,27 @@ | | | @@ -108,27 +108,27 @@ |
108 | | | 108 | |
109 | #include <errno.h> | | 109 | #include <errno.h> |
110 | #include <signal.h> | | 110 | #include <signal.h> |
111 | #include <stdarg.h> | | 111 | #include <stdarg.h> |
112 | #include <time.h> | | 112 | #include <time.h> |
113 | | | 113 | |
114 | #include "make.h" | | 114 | #include "make.h" |
115 | #include "dir.h" | | 115 | #include "dir.h" |
116 | #include "job.h" | | 116 | #include "job.h" |
117 | #include "pathnames.h" | | 117 | #include "pathnames.h" |
118 | #include "trace.h" | | 118 | #include "trace.h" |
119 | | | 119 | |
120 | /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ | | 120 | /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ |
121 | MAKE_RCSID("$NetBSD: main.c,v 1.423 2020/11/04 04:49:32 rillig Exp $"); | | 121 | MAKE_RCSID("$NetBSD: main.c,v 1.424 2020/11/04 13:22:15 rillig Exp $"); |
122 | #if defined(MAKE_NATIVE) && !defined(lint) | | 122 | #if defined(MAKE_NATIVE) && !defined(lint) |
123 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " | | 123 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " |
124 | "The Regents of the University of California. " | | 124 | "The Regents of the University of California. " |
125 | "All rights reserved."); | | 125 | "All rights reserved."); |
126 | #endif | | 126 | #endif |
127 | | | 127 | |
128 | #ifndef DEFMAXLOCAL | | 128 | #ifndef DEFMAXLOCAL |
129 | #define DEFMAXLOCAL DEFMAXJOBS | | 129 | #define DEFMAXLOCAL DEFMAXJOBS |
130 | #endif | | 130 | #endif |
131 | | | 131 | |
132 | CmdOpts opts; | | 132 | CmdOpts opts; |
133 | time_t now; /* Time at start of make */ | | 133 | time_t now; /* Time at start of make */ |
134 | GNode *DEFAULT; /* .DEFAULT node */ | | 134 | GNode *DEFAULT; /* .DEFAULT node */ |
| @@ -1262,27 +1262,27 @@ InitVpath(void) | | | @@ -1262,27 +1262,27 @@ InitVpath(void) |
1262 | static void | | 1262 | static void |
1263 | ReadMakefiles(void) | | 1263 | ReadMakefiles(void) |
1264 | { | | 1264 | { |
1265 | if (opts.makefiles->first != NULL) { | | 1265 | if (opts.makefiles->first != NULL) { |
1266 | StringListNode *ln; | | 1266 | StringListNode *ln; |
1267 | | | 1267 | |
1268 | for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) { | | 1268 | for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) { |
1269 | if (ReadMakefile(ln->datum) != 0) | | 1269 | if (ReadMakefile(ln->datum) != 0) |
1270 | Fatal("%s: cannot open %s.", | | 1270 | Fatal("%s: cannot open %s.", |
1271 | progname, (char *)ln->datum); | | 1271 | progname, (char *)ln->datum); |
1272 | } | | 1272 | } |
1273 | } else { | | 1273 | } else { |
1274 | char *p1; | | 1274 | char *p1; |
1275 | (void)Var_Subst("${" MAKEFILE_PREFERENCE "}", | | 1275 | (void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}", |
1276 | VAR_CMDLINE, VARE_WANTRES, &p1); | | 1276 | VAR_CMDLINE, VARE_WANTRES, &p1); |
1277 | /* TODO: handle errors */ | | 1277 | /* TODO: handle errors */ |
1278 | (void)str2Lst_Append(opts.makefiles, p1, NULL); | | 1278 | (void)str2Lst_Append(opts.makefiles, p1, NULL); |
1279 | (void)Lst_ForEachUntil(opts.makefiles, | | 1279 | (void)Lst_ForEachUntil(opts.makefiles, |
1280 | ReadMakefileSucceeded, NULL); | | 1280 | ReadMakefileSucceeded, NULL); |
1281 | free(p1); | | 1281 | free(p1); |
1282 | } | | 1282 | } |
1283 | } | | 1283 | } |
1284 | | | 1284 | |
1285 | static void | | 1285 | static void |
1286 | CleanUp(void) | | 1286 | CleanUp(void) |
1287 | { | | 1287 | { |
1288 | #ifdef CLEANUP | | 1288 | #ifdef CLEANUP |
| @@ -1385,27 +1385,27 @@ main(int argc, char **argv) | | | @@ -1385,27 +1385,27 @@ main(int argc, char **argv) |
1385 | Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL); | | 1385 | Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL); |
1386 | Var_Set("MACHINE", machine, VAR_GLOBAL); | | 1386 | Var_Set("MACHINE", machine, VAR_GLOBAL); |
1387 | Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL); | | 1387 | Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL); |
1388 | #ifdef MAKE_VERSION | | 1388 | #ifdef MAKE_VERSION |
1389 | Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL); | | 1389 | Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL); |
1390 | #endif | | 1390 | #endif |
1391 | Var_Set(".newline", "\n", VAR_GLOBAL); /* handy for :@ loops */ | | 1391 | Var_Set(".newline", "\n", VAR_GLOBAL); /* handy for :@ loops */ |
1392 | /* | | 1392 | /* |
1393 | * This is the traditional preference for makefiles. | | 1393 | * This is the traditional preference for makefiles. |
1394 | */ | | 1394 | */ |
1395 | #ifndef MAKEFILE_PREFERENCE_LIST | | 1395 | #ifndef MAKEFILE_PREFERENCE_LIST |
1396 | # define MAKEFILE_PREFERENCE_LIST "makefile Makefile" | | 1396 | # define MAKEFILE_PREFERENCE_LIST "makefile Makefile" |
1397 | #endif | | 1397 | #endif |
1398 | Var_Set(MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST, | | 1398 | Var_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST, |
1399 | VAR_GLOBAL); | | 1399 | VAR_GLOBAL); |
1400 | Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL); | | 1400 | Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL); |
1401 | | | 1401 | |
1402 | CmdOpts_Init(); | | 1402 | CmdOpts_Init(); |
1403 | allPrecious = FALSE; /* Remove targets when interrupted */ | | 1403 | allPrecious = FALSE; /* Remove targets when interrupted */ |
1404 | deleteOnError = FALSE; /* Historical default behavior */ | | 1404 | deleteOnError = FALSE; /* Historical default behavior */ |
1405 | jobsRunning = FALSE; | | 1405 | jobsRunning = FALSE; |
1406 | | | 1406 | |
1407 | maxJobTokens = opts.maxJobs; | | 1407 | maxJobTokens = opts.maxJobs; |
1408 | ignorePWD = FALSE; | | 1408 | ignorePWD = FALSE; |
1409 | | | 1409 | |
1410 | /* | | 1410 | /* |
1411 | * Initialize the parsing, directory and variable modules to prepare | | 1411 | * Initialize the parsing, directory and variable modules to prepare |