make(1): rename defIncPath to defSysIncPath There are two variables, parseIncPath and sysIncPath, which made the name defIncPath ambiguous.diff -r1.408 -r1.409 src/usr.bin/make/main.c
(rillig)
--- src/usr.bin/make/main.c 2020/10/27 19:16:46 1.408
+++ src/usr.bin/make/main.c 2020/10/28 03:21:25 1.409
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: main.c,v 1.408 2020/10/27 19:16:46 rillig Exp $ */ | 1 | /* $NetBSD: main.c,v 1.409 2020/10/28 03:21:25 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.408 2020/10/27 19:16:46 rillig Exp $"); | 121 | MAKE_RCSID("$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 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 */ | |
@@ -1131,70 +1131,70 @@ InitVarMake(const char *argv0) | @@ -1131,70 +1131,70 @@ InitVarMake(const char *argv0) | |||
1131 | if (argv0[0] != '/' && strchr(argv0, '/') != NULL) { | 1131 | if (argv0[0] != '/' && strchr(argv0, '/') != NULL) { | |
1132 | char pathbuf[MAXPATHLEN]; | 1132 | char pathbuf[MAXPATHLEN]; | |
1133 | const char *abs = cached_realpath(argv0, pathbuf); | 1133 | const char *abs = cached_realpath(argv0, pathbuf); | |
1134 | struct stat st; | 1134 | struct stat st; | |
1135 | if (abs != NULL && abs[0] == '/' && stat(make, &st) == 0) | 1135 | if (abs != NULL && abs[0] == '/' && stat(make, &st) == 0) | |
1136 | make = abs; | 1136 | make = abs; | |
1137 | } | 1137 | } | |
1138 | 1138 | |||
1139 | Var_Set("MAKE", make, VAR_GLOBAL); | 1139 | Var_Set("MAKE", make, VAR_GLOBAL); | |
1140 | Var_Set(".MAKE", make, VAR_GLOBAL); | 1140 | Var_Set(".MAKE", make, VAR_GLOBAL); | |
1141 | } | 1141 | } | |
1142 | 1142 | |||
1143 | static void | 1143 | static void | |
1144 | InitDefIncPath(char *syspath) | 1144 | InitDefSysIncPath(char *syspath) | |
1145 | { | 1145 | { | |
1146 | static char defsyspath[] = _PATH_DEFSYSPATH; | 1146 | static char defsyspath[] = _PATH_DEFSYSPATH; | |
1147 | char *start, *cp; | 1147 | char *start, *cp; | |
1148 | 1148 | |||
1149 | /* | 1149 | /* | |
1150 | * If no user-supplied system path was given (through the -m option) | 1150 | * If no user-supplied system path was given (through the -m option) | |
1151 | * add the directories from the DEFSYSPATH (more than one may be given | 1151 | * add the directories from the DEFSYSPATH (more than one may be given | |
1152 | * as dir1:...:dirn) to the system include path. | 1152 | * as dir1:...:dirn) to the system include path. | |
1153 | */ | 1153 | */ | |
1154 | /* XXX: mismatch: the -m option sets sysIncPath, not syspath */ | 1154 | /* XXX: mismatch: the -m option sets sysIncPath, not syspath */ | |
1155 | if (syspath == NULL || syspath[0] == '\0') | 1155 | if (syspath == NULL || syspath[0] == '\0') | |
1156 | syspath = defsyspath; | 1156 | syspath = defsyspath; | |
1157 | else | 1157 | else | |
1158 | syspath = bmake_strdup(syspath); | 1158 | syspath = bmake_strdup(syspath); | |
1159 | 1159 | |||
1160 | for (start = syspath; *start != '\0'; start = cp) { | 1160 | for (start = syspath; *start != '\0'; start = cp) { | |
1161 | for (cp = start; *cp != '\0' && *cp != ':'; cp++) | 1161 | for (cp = start; *cp != '\0' && *cp != ':'; cp++) | |
1162 | continue; | 1162 | continue; | |
1163 | if (*cp == ':') { | 1163 | if (*cp == ':') { | |
1164 | *cp++ = '\0'; | 1164 | *cp++ = '\0'; | |
1165 | } | 1165 | } | |
1166 | /* look for magic parent directory search string */ | 1166 | /* look for magic parent directory search string */ | |
1167 | if (strncmp(".../", start, 4) != 0) { | 1167 | if (strncmp(".../", start, 4) != 0) { | |
1168 | (void)Dir_AddDir(defIncPath, start); | 1168 | (void)Dir_AddDir(defSysIncPath, start); | |
1169 | } else { | 1169 | } else { | |
1170 | char *dir = Dir_FindHereOrAbove(curdir, start + 4); | 1170 | char *dir = Dir_FindHereOrAbove(curdir, start + 4); | |
1171 | if (dir != NULL) { | 1171 | if (dir != NULL) { | |
1172 | (void)Dir_AddDir(defIncPath, dir); | 1172 | (void)Dir_AddDir(defSysIncPath, dir); | |
1173 | free(dir); | 1173 | free(dir); | |
1174 | } | 1174 | } | |
1175 | } | 1175 | } | |
1176 | } | 1176 | } | |
1177 | 1177 | |||
1178 | if (syspath != defsyspath) | 1178 | if (syspath != defsyspath) | |
1179 | free(syspath); | 1179 | free(syspath); | |
1180 | } | 1180 | } | |
1181 | 1181 | |||
1182 | static void | 1182 | static void | |
1183 | ReadBuiltinRules(void) | 1183 | ReadBuiltinRules(void) | |
1184 | { | 1184 | { | |
1185 | StringList *sysMkPath = Lst_New(); | 1185 | StringList *sysMkPath = Lst_New(); | |
1186 | Dir_Expand(_PATH_DEFSYSMK, | 1186 | Dir_Expand(_PATH_DEFSYSMK, | |
1187 | Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath, | 1187 | Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath, | |
1188 | sysMkPath); | 1188 | sysMkPath); | |
1189 | if (Lst_IsEmpty(sysMkPath)) | 1189 | if (Lst_IsEmpty(sysMkPath)) | |
1190 | Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK); | 1190 | Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK); | |
1191 | if (!Lst_ForEachUntil(sysMkPath, ReadMakefileSucceeded, NULL)) | 1191 | if (!Lst_ForEachUntil(sysMkPath, ReadMakefileSucceeded, NULL)) | |
1192 | Fatal("%s: cannot open %s.", progname, | 1192 | Fatal("%s: cannot open %s.", progname, | |
1193 | (char *)sysMkPath->first->datum); | 1193 | (char *)sysMkPath->first->datum); | |
1194 | /* XXX: sysMkPath is not freed */ | 1194 | /* XXX: sysMkPath is not freed */ | |
1195 | } | 1195 | } | |
1196 | 1196 | |||
1197 | static void | 1197 | static void | |
1198 | InitMaxJobs(void) | 1198 | InitMaxJobs(void) | |
1199 | { | 1199 | { | |
1200 | char *value; | 1200 | char *value; | |
@@ -1505,27 +1505,27 @@ main(int argc, char **argv) | @@ -1505,27 +1505,27 @@ main(int argc, char **argv) | |||
1505 | */ | 1505 | */ | |
1506 | Arch_Init(); | 1506 | Arch_Init(); | |
1507 | Targ_Init(); | 1507 | Targ_Init(); | |
1508 | Suff_Init(); | 1508 | Suff_Init(); | |
1509 | Trace_Init(tracefile); | 1509 | Trace_Init(tracefile); | |
1510 | 1510 | |||
1511 | DEFAULT = NULL; | 1511 | DEFAULT = NULL; | |
1512 | (void)time(&now); | 1512 | (void)time(&now); | |
1513 | 1513 | |||
1514 | Trace_Log(MAKESTART, NULL); | 1514 | Trace_Log(MAKESTART, NULL); | |
1515 | 1515 | |||
1516 | InitVarTargets(); | 1516 | InitVarTargets(); | |
1517 | 1517 | |||
1518 | InitDefIncPath(syspath); | 1518 | InitDefSysIncPath(syspath); | |
1519 | 1519 | |||
1520 | /* | 1520 | /* | |
1521 | * Read in the built-in rules first, followed by the specified | 1521 | * Read in the built-in rules first, followed by the specified | |
1522 | * makefiles, or the default makefile and Makefile, in that order, | 1522 | * makefiles, or the default makefile and Makefile, in that order, | |
1523 | * if no makefiles were given on the command line. | 1523 | * if no makefiles were given on the command line. | |
1524 | */ | 1524 | */ | |
1525 | if (!opts.noBuiltins) | 1525 | if (!opts.noBuiltins) | |
1526 | ReadBuiltinRules(); | 1526 | ReadBuiltinRules(); | |
1527 | ReadMakefiles(); | 1527 | ReadMakefiles(); | |
1528 | 1528 | |||
1529 | /* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */ | 1529 | /* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */ | |
1530 | if (!opts.noBuiltins || !opts.printVars) { | 1530 | if (!opts.noBuiltins || !opts.printVars) { | |
1531 | /* ignore /dev/null and anything starting with "no" */ | 1531 | /* ignore /dev/null and anything starting with "no" */ | |
@@ -1624,29 +1624,31 @@ ReadMakefile(const char *fname) | @@ -1624,29 +1624,31 @@ ReadMakefile(const char *fname) | |||
1624 | path = str_concat3(objdir, "/", fname); | 1624 | path = str_concat3(objdir, "/", fname); | |
1625 | fd = open(path, O_RDONLY); | 1625 | fd = open(path, O_RDONLY); | |
1626 | if (fd != -1) { | 1626 | if (fd != -1) { | |
1627 | fname = path; | 1627 | fname = path; | |
1628 | goto found; | 1628 | goto found; | |
1629 | } | 1629 | } | |
1630 | } else { | 1630 | } else { | |
1631 | fd = open(fname, O_RDONLY); | 1631 | fd = open(fname, O_RDONLY); | |
1632 | if (fd != -1) | 1632 | if (fd != -1) | |
1633 | goto found; | 1633 | goto found; | |
1634 | } | 1634 | } | |
1635 | /* look in -I and system include directories. */ | 1635 | /* look in -I and system include directories. */ | |
1636 | name = Dir_FindFile(fname, parseIncPath); | 1636 | name = Dir_FindFile(fname, parseIncPath); | |
1637 | if (!name) | 1637 | if (!name) { | |
1638 | name = Dir_FindFile(fname, | 1638 | SearchPath *sysInc = Lst_IsEmpty(sysIncPath) | |
1639 | Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath); | 1639 | ? defSysIncPath : sysIncPath; | |
1640 | name = Dir_FindFile(fname, sysInc); | |||
1641 | } | |||
1640 | if (!name || (fd = open(name, O_RDONLY)) == -1) { | 1642 | if (!name || (fd = open(name, O_RDONLY)) == -1) { | |
1641 | free(name); | 1643 | free(name); | |
1642 | free(path); | 1644 | free(path); | |
1643 | return -1; | 1645 | return -1; | |
1644 | } | 1646 | } | |
1645 | fname = name; | 1647 | fname = name; | |
1646 | /* | 1648 | /* | |
1647 | * set the MAKEFILE variable desired by System V fans -- the | 1649 | * set the MAKEFILE variable desired by System V fans -- the | |
1648 | * placement of the setting here means it gets set to the last | 1650 | * placement of the setting here means it gets set to the last | |
1649 | * makefile specified, as it is set by SysV make. | 1651 | * makefile specified, as it is set by SysV make. | |
1650 | */ | 1652 | */ | |
1651 | found: | 1653 | found: | |
1652 | if (!doing_depend) | 1654 | if (!doing_depend) |
--- src/usr.bin/make/parse.c 2020/10/28 03:12:54 1.408
+++ src/usr.bin/make/parse.c 2020/10/28 03:21:25 1.409
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: parse.c,v 1.408 2020/10/28 03:12:54 rillig Exp $ */ | 1 | /* $NetBSD: parse.c,v 1.409 2020/10/28 03:21:25 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. | |
@@ -107,27 +107,27 @@ | @@ -107,27 +107,27 @@ | |||
107 | #ifndef MAP_FILE | 107 | #ifndef MAP_FILE | |
108 | #define MAP_FILE 0 | 108 | #define MAP_FILE 0 | |
109 | #endif | 109 | #endif | |
110 | #ifndef MAP_COPY | 110 | #ifndef MAP_COPY | |
111 | #define MAP_COPY MAP_PRIVATE | 111 | #define MAP_COPY MAP_PRIVATE | |
112 | #endif | 112 | #endif | |
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 | 118 | |||
119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ | 119 | /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ | |
120 | MAKE_RCSID("$NetBSD: parse.c,v 1.408 2020/10/28 03:12:54 rillig Exp $"); | 120 | MAKE_RCSID("$NetBSD: parse.c,v 1.409 2020/10/28 03:21:25 rillig Exp $"); | |
121 | 121 | |||
122 | /* types and constants */ | 122 | /* types and constants */ | |
123 | 123 | |||
124 | /* | 124 | /* | |
125 | * Structure for a file being read ("included file") | 125 | * Structure for a file being read ("included file") | |
126 | */ | 126 | */ | |
127 | typedef struct IFile { | 127 | typedef struct IFile { | |
128 | char *fname; /* name of file */ | 128 | char *fname; /* name of file */ | |
129 | Boolean fromForLoop; /* simulated .include by the .for loop */ | 129 | Boolean fromForLoop; /* simulated .include by the .for loop */ | |
130 | int lineno; /* current line number in file */ | 130 | int lineno; /* current line number in file */ | |
131 | int first_lineno; /* line number of start of text */ | 131 | int first_lineno; /* line number of start of text */ | |
132 | unsigned int cond_depth; /* 'if' nesting when file opened */ | 132 | unsigned int cond_depth; /* 'if' nesting when file opened */ | |
133 | Boolean depending; /* state of doing_depend on EOF */ | 133 | Boolean depending; /* state of doing_depend on EOF */ | |
@@ -270,30 +270,30 @@ static Vector /* of IFile */ includes; | @@ -270,30 +270,30 @@ static Vector /* of IFile */ includes; | |||
270 | static IFile * | 270 | static IFile * | |
271 | GetInclude(size_t i) | 271 | GetInclude(size_t i) | |
272 | { | 272 | { | |
273 | return Vector_Get(&includes, i); | 273 | return Vector_Get(&includes, i); | |
274 | } | 274 | } | |
275 | 275 | |||
276 | /* The file that is currently being read. */ | 276 | /* The file that is currently being read. */ | |
277 | static IFile * | 277 | static IFile * | |
278 | CurFile(void) | 278 | CurFile(void) | |
279 | { | 279 | { | |
280 | return GetInclude(includes.len - 1); | 280 | return GetInclude(includes.len - 1); | |
281 | } | 281 | } | |
282 | 282 | |||
283 | /* include paths (lists of directories) */ | 283 | /* include paths */ | |
284 | SearchPath *parseIncPath; /* dirs for "..." includes */ | 284 | SearchPath *parseIncPath; /* dirs for "..." includes */ | |
285 | SearchPath *sysIncPath; /* dirs for <...> includes */ | 285 | SearchPath *sysIncPath; /* dirs for <...> includes */ | |
286 | SearchPath *defIncPath; /* default for sysIncPath */ | 286 | SearchPath *defSysIncPath; /* default for sysIncPath */ | |
287 | 287 | |||
288 | /* parser tables */ | 288 | /* parser tables */ | |
289 | 289 | |||
290 | /* | 290 | /* | |
291 | * The parseKeywords table is searched using binary search when deciding | 291 | * The parseKeywords table is searched using binary search when deciding | |
292 | * if a target or source is special. The 'spec' field is the ParseSpecial | 292 | * if a target or source is special. The 'spec' field is the ParseSpecial | |
293 | * type of the keyword (SP_NOT if the keyword isn't special as a target) while | 293 | * type of the keyword (SP_NOT if the keyword isn't special as a target) while | |
294 | * the 'op' field is the operator to apply to the list of targets if the | 294 | * the 'op' field is the operator to apply to the list of targets if the | |
295 | * keyword is used as a source ("0" if the keyword isn't special as a source) | 295 | * keyword is used as a source ("0" if the keyword isn't special as a source) | |
296 | */ | 296 | */ | |
297 | static const struct { | 297 | static const struct { | |
298 | const char *name; /* Name of keyword */ | 298 | const char *name; /* Name of keyword */ | |
299 | ParseSpecial spec; /* Type when used as a target */ | 299 | ParseSpecial spec; /* Type when used as a target */ | |
@@ -2196,27 +2196,27 @@ Parse_include_file(char *file, Boolean i | @@ -2196,27 +2196,27 @@ Parse_include_file(char *file, Boolean i | |||
2196 | fullname = Dir_FindFile(file, parseIncPath); | 2196 | fullname = Dir_FindFile(file, parseIncPath); | |
2197 | if (fullname == NULL) { | 2197 | if (fullname == NULL) { | |
2198 | fullname = Dir_FindFile(file, dirSearchPath); | 2198 | fullname = Dir_FindFile(file, dirSearchPath); | |
2199 | } | 2199 | } | |
2200 | } | 2200 | } | |
2201 | } | 2201 | } | |
2202 | } | 2202 | } | |
2203 | 2203 | |||
2204 | /* Looking for a system file or file still not found */ | 2204 | /* Looking for a system file or file still not found */ | |
2205 | if (fullname == NULL) { | 2205 | if (fullname == NULL) { | |
2206 | /* | 2206 | /* | |
2207 | * Look for it on the system path | 2207 | * Look for it on the system path | |
2208 | */ | 2208 | */ | |
2209 | SearchPath *path = Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath; | 2209 | SearchPath *path = Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath; | |
2210 | fullname = Dir_FindFile(file, path); | 2210 | fullname = Dir_FindFile(file, path); | |
2211 | } | 2211 | } | |
2212 | 2212 | |||
2213 | if (fullname == NULL) { | 2213 | if (fullname == NULL) { | |
2214 | if (!silent) | 2214 | if (!silent) | |
2215 | Parse_Error(PARSE_FATAL, "Could not find %s", file); | 2215 | Parse_Error(PARSE_FATAL, "Could not find %s", file); | |
2216 | return; | 2216 | return; | |
2217 | } | 2217 | } | |
2218 | 2218 | |||
2219 | /* Actually open the file... */ | 2219 | /* Actually open the file... */ | |
2220 | fd = open(fullname, O_RDONLY); | 2220 | fd = open(fullname, O_RDONLY); | |
2221 | if (fd == -1) { | 2221 | if (fd == -1) { | |
2222 | if (!silent) | 2222 | if (!silent) | |
@@ -3134,41 +3134,41 @@ Parse_File(const char *name, int fd) | @@ -3134,41 +3134,41 @@ Parse_File(const char *name, int fd) | |||
3134 | progname); | 3134 | progname); | |
3135 | PrintOnError(NULL, NULL); | 3135 | PrintOnError(NULL, NULL); | |
3136 | exit(1); | 3136 | exit(1); | |
3137 | } | 3137 | } | |
3138 | } | 3138 | } | |
3139 | 3139 | |||
3140 | /* Initialize the parsing module. */ | 3140 | /* Initialize the parsing module. */ | |
3141 | void | 3141 | void | |
3142 | Parse_Init(void) | 3142 | Parse_Init(void) | |
3143 | { | 3143 | { | |
3144 | mainNode = NULL; | 3144 | mainNode = NULL; | |
3145 | parseIncPath = Lst_New(); | 3145 | parseIncPath = Lst_New(); | |
3146 | sysIncPath = Lst_New(); | 3146 | sysIncPath = Lst_New(); | |
3147 | defIncPath = Lst_New(); | 3147 | defSysIncPath = Lst_New(); | |
3148 | Vector_Init(&includes, sizeof(IFile)); | 3148 | Vector_Init(&includes, sizeof(IFile)); | |
3149 | #ifdef CLEANUP | 3149 | #ifdef CLEANUP | |
3150 | targCmds = Lst_New(); | 3150 | targCmds = Lst_New(); | |
3151 | #endif | 3151 | #endif | |
3152 | } | 3152 | } | |
3153 | 3153 | |||
3154 | /* Clean up the parsing module. */ | 3154 | /* Clean up the parsing module. */ | |
3155 | void | 3155 | void | |
3156 | Parse_End(void) | 3156 | Parse_End(void) | |
3157 | { | 3157 | { | |
3158 | #ifdef CLEANUP | 3158 | #ifdef CLEANUP | |
3159 | Lst_Destroy(targCmds, free); | 3159 | Lst_Destroy(targCmds, free); | |
3160 | assert(targets == NULL); | 3160 | assert(targets == NULL); | |
3161 | Lst_Destroy(defIncPath, Dir_Destroy); | 3161 | Lst_Destroy(defSysIncPath, Dir_Destroy); | |
3162 | Lst_Destroy(sysIncPath, Dir_Destroy); | 3162 | Lst_Destroy(sysIncPath, Dir_Destroy); | |
3163 | Lst_Destroy(parseIncPath, Dir_Destroy); | 3163 | Lst_Destroy(parseIncPath, Dir_Destroy); | |
3164 | assert(includes.len == 0); | 3164 | assert(includes.len == 0); | |
3165 | Vector_Done(&includes); | 3165 | Vector_Done(&includes); | |
3166 | #endif | 3166 | #endif | |
3167 | } | 3167 | } | |
3168 | 3168 | |||
3169 | 3169 | |||
3170 | /*- | 3170 | /*- | |
3171 | *----------------------------------------------------------------------- | 3171 | *----------------------------------------------------------------------- | |
3172 | * Parse_MainName -- | 3172 | * Parse_MainName -- | |
3173 | * Return a Lst of the main target to create for main()'s sake. If | 3173 | * Return a Lst of the main target to create for main()'s sake. If | |
3174 | * no such target exists, we Punt with an obnoxious error message. | 3174 | * no such target exists, we Punt with an obnoxious error message. |
--- src/usr.bin/make/make.h 2020/10/27 07:03:55 1.174
+++ src/usr.bin/make/make.h 2020/10/28 03:21:25 1.175
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: make.h,v 1.174 2020/10/27 07:03:55 rillig Exp $ */ | 1 | /* $NetBSD: make.h,v 1.175 2020/10/28 03:21:25 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. | |
@@ -437,27 +437,27 @@ extern GNode *VAR_GLOBAL; /* Variable | @@ -437,27 +437,27 @@ extern GNode *VAR_GLOBAL; /* Variable | |||
437 | * in the Makefile itself */ | 437 | * in the Makefile itself */ | |
438 | extern GNode *VAR_CMD; /* Variables defined on the command line */ | 438 | extern GNode *VAR_CMD; /* Variables defined on the command line */ | |
439 | extern char var_Error[]; /* Value returned by Var_Parse when an error | 439 | extern char var_Error[]; /* Value returned by Var_Parse when an error | |
440 | * is encountered. It actually points to | 440 | * is encountered. It actually points to | |
441 | * an empty string, so naive callers needn't | 441 | * an empty string, so naive callers needn't | |
442 | * worry about it. */ | 442 | * worry about it. */ | |
443 | 443 | |||
444 | extern time_t now; /* The time at the start of this whole | 444 | extern time_t now; /* The time at the start of this whole | |
445 | * process */ | 445 | * process */ | |
446 | 446 | |||
447 | extern Boolean oldVars; /* Do old-style variable substitution */ | 447 | extern Boolean oldVars; /* Do old-style variable substitution */ | |
448 | 448 | |||
449 | extern SearchPath *sysIncPath; /* The system include path. */ | 449 | extern SearchPath *sysIncPath; /* The system include path. */ | |
450 | extern SearchPath *defIncPath; /* The default include path. */ | 450 | extern SearchPath *defSysIncPath; /* The default system include path. */ | |
451 | 451 | |||
452 | extern char curdir[]; /* Startup directory */ | 452 | extern char curdir[]; /* Startup directory */ | |
453 | extern char *progname; /* The program name */ | 453 | extern char *progname; /* The program name */ | |
454 | extern char *makeDependfile; /* .depend */ | 454 | extern char *makeDependfile; /* .depend */ | |
455 | extern char **savedEnv; /* if we replaced environ this will be non-NULL */ | 455 | extern char **savedEnv; /* if we replaced environ this will be non-NULL */ | |
456 | 456 | |||
457 | extern int makelevel; | 457 | extern int makelevel; | |
458 | 458 | |||
459 | /* | 459 | /* | |
460 | * We cannot vfork() in a child of vfork(). | 460 | * We cannot vfork() in a child of vfork(). | |
461 | * Most systems do not enforce this but some do. | 461 | * Most systems do not enforce this but some do. | |
462 | */ | 462 | */ | |
463 | #define vFork() ((getpid() == myPid) ? vfork() : fork()) | 463 | #define vFork() ((getpid() == myPid) ? vfork() : fork()) |