| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $ */ | | 1 | /* $NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 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. |
| @@ -59,34 +59,34 @@ | | | @@ -59,34 +59,34 @@ |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
68 | * SUCH DAMAGE. | | 68 | * SUCH DAMAGE. |
69 | */ | | 69 | */ |
70 | | | 70 | |
71 | #ifndef MAKE_NATIVE | | 71 | #ifndef MAKE_NATIVE |
72 | static char rcsid[] = "$NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $"; | | 72 | static char rcsid[] = "$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $"; |
73 | #else | | 73 | #else |
74 | #include <sys/cdefs.h> | | 74 | #include <sys/cdefs.h> |
75 | #ifndef lint | | 75 | #ifndef lint |
76 | #if 0 | | 76 | #if 0 |
77 | static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; | | 77 | static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; |
78 | #else | | 78 | #else |
79 | __RCSID("$NetBSD: parse.c,v 1.239 2020/07/28 16:42:22 rillig Exp $"); | | 79 | __RCSID("$NetBSD: parse.c,v 1.240 2020/07/28 18:15:11 rillig Exp $"); |
80 | #endif | | 80 | #endif |
81 | #endif /* not lint */ | | 81 | #endif /* not lint */ |
82 | #endif | | 82 | #endif |
83 | | | 83 | |
84 | /*- | | 84 | /*- |
85 | * parse.c -- | | 85 | * parse.c -- |
86 | * Functions to parse a makefile. | | 86 | * Functions to parse a makefile. |
87 | * | | 87 | * |
88 | * One function, Parse_Init, must be called before any functions | | 88 | * One function, Parse_Init, must be called before any functions |
89 | * in this module are used. After that, the function Parse_File is the | | 89 | * in this module are used. After that, the function Parse_File is the |
90 | * main entry point and controls most of the other functions in this | | 90 | * main entry point and controls most of the other functions in this |
91 | * module. | | 91 | * module. |
92 | * | | 92 | * |
| @@ -1279,27 +1279,36 @@ ParseDoDependency(char *line) | | | @@ -1279,27 +1279,36 @@ ParseDoDependency(char *line) |
1279 | /* | | 1279 | /* |
1280 | * We got to the end of the line while we were still | | 1280 | * We got to the end of the line while we were still |
1281 | * looking at targets. | | 1281 | * looking at targets. |
1282 | * | | 1282 | * |
1283 | * Ending a dependency line without an operator is a Bozo | | 1283 | * Ending a dependency line without an operator is a Bozo |
1284 | * no-no. As a heuristic, this is also often triggered by | | 1284 | * no-no. As a heuristic, this is also often triggered by |
1285 | * undetected conflicts from cvs/rcs merges. | | 1285 | * undetected conflicts from cvs/rcs merges. |
1286 | */ | | 1286 | */ |
1287 | if ((strncmp(line, "<<<<<<", 6) == 0) || | | 1287 | if ((strncmp(line, "<<<<<<", 6) == 0) || |
1288 | (strncmp(line, "======", 6) == 0) || | | 1288 | (strncmp(line, "======", 6) == 0) || |
1289 | (strncmp(line, ">>>>>>", 6) == 0)) | | 1289 | (strncmp(line, ">>>>>>", 6) == 0)) |
1290 | Parse_Error(PARSE_FATAL, | | 1290 | Parse_Error(PARSE_FATAL, |
1291 | "Makefile appears to contain unresolved cvs/rcs/??? merge conflicts"); | | 1291 | "Makefile appears to contain unresolved cvs/rcs/??? merge conflicts"); |
1292 | else | | 1292 | else if (lstart[0] == '.') { |
| | | 1293 | const char *dirstart = lstart + 1; |
| | | 1294 | while (isspace((unsigned char)*dirstart)) |
| | | 1295 | dirstart++; |
| | | 1296 | const char *dirend = dirstart; |
| | | 1297 | while (isalnum((unsigned char)*dirend) || *dirend == '-') |
| | | 1298 | dirend++; |
| | | 1299 | Parse_Error(PARSE_FATAL, "Unknown directive \"%.*s\"", |
| | | 1300 | (int)(dirend - dirstart), dirstart); |
| | | 1301 | } else |
1293 | Parse_Error(PARSE_FATAL, lstart[0] == '.' ? "Unknown directive" | | 1302 | Parse_Error(PARSE_FATAL, lstart[0] == '.' ? "Unknown directive" |
1294 | : "Need an operator"); | | 1303 | : "Need an operator"); |
1295 | goto out; | | 1304 | goto out; |
1296 | } | | 1305 | } |
1297 | | | 1306 | |
1298 | /* Insert a null terminator. */ | | 1307 | /* Insert a null terminator. */ |
1299 | savec = *cp; | | 1308 | savec = *cp; |
1300 | *cp = '\0'; | | 1309 | *cp = '\0'; |
1301 | | | 1310 | |
1302 | /* | | 1311 | /* |
1303 | * Got the word. See if it's a special target and if so set | | 1312 | * Got the word. See if it's a special target and if so set |
1304 | * specType to match it. | | 1313 | * specType to match it. |
1305 | */ | | 1314 | */ |