| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: parse.c,v 1.405 2020/10/28 01:47:11 rillig Exp $ */ | | 1 | /* $NetBSD: parse.c,v 1.406 2020/10/28 01:51:36 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.405 2020/10/28 01:47:11 rillig Exp $"); | | 120 | MAKE_RCSID("$NetBSD: parse.c,v 1.406 2020/10/28 01:51:36 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 */ |
| @@ -136,61 +136,61 @@ typedef struct IFile { | | | @@ -136,61 +136,61 @@ typedef struct IFile { |
136 | char *buf_freeIt; | | 136 | char *buf_freeIt; |
137 | char *buf_ptr; /* next char to be read */ | | 137 | char *buf_ptr; /* next char to be read */ |
138 | char *buf_end; | | 138 | char *buf_end; |
139 | | | 139 | |
140 | char *(*nextbuf)(void *, size_t *); /* Function to get more data */ | | 140 | char *(*nextbuf)(void *, size_t *); /* Function to get more data */ |
141 | void *nextbuf_arg; /* Opaque arg for nextbuf() */ | | 141 | void *nextbuf_arg; /* Opaque arg for nextbuf() */ |
142 | struct loadedfile *lf; /* loadedfile object, if any */ | | 142 | struct loadedfile *lf; /* loadedfile object, if any */ |
143 | } IFile; | | 143 | } IFile; |
144 | | | 144 | |
145 | /* | | 145 | /* |
146 | * Tokens for target attributes | | 146 | * Tokens for target attributes |
147 | */ | | 147 | */ |
148 | typedef enum ParseSpecial { | | 148 | typedef enum ParseSpecial { |
| | | 149 | SP_ATTRIBUTE, /* Generic attribute */ |
149 | SP_BEGIN, /* .BEGIN */ | | 150 | SP_BEGIN, /* .BEGIN */ |
150 | SP_DEFAULT, /* .DEFAULT */ | | 151 | SP_DEFAULT, /* .DEFAULT */ |
151 | SP_DELETE_ON_ERROR, /* .DELETE_ON_ERROR */ | | 152 | SP_DELETE_ON_ERROR, /* .DELETE_ON_ERROR */ |
152 | SP_END, /* .END */ | | 153 | SP_END, /* .END */ |
153 | SP_ERROR, /* .ERROR */ | | 154 | SP_ERROR, /* .ERROR */ |
154 | SP_IGNORE, /* .IGNORE */ | | 155 | SP_IGNORE, /* .IGNORE */ |
155 | SP_INCLUDES, /* .INCLUDES; not mentioned in the manual page */ | | 156 | SP_INCLUDES, /* .INCLUDES; not mentioned in the manual page */ |
156 | SP_INTERRUPT, /* .INTERRUPT */ | | 157 | SP_INTERRUPT, /* .INTERRUPT */ |
157 | SP_LIBS, /* .LIBS; not mentioned in the manual page */ | | 158 | SP_LIBS, /* .LIBS; not mentioned in the manual page */ |
158 | SP_META, /* .META */ | | | |
159 | SP_MFLAGS, /* .MFLAGS or .MAKEFLAGS */ | | | |
160 | SP_MAIN, /* .MAIN and we don't have anything user-specified to | | 159 | SP_MAIN, /* .MAIN and we don't have anything user-specified to |
161 | * make */ | | 160 | * make */ |
| | | 161 | SP_META, /* .META */ |
| | | 162 | SP_MFLAGS, /* .MFLAGS or .MAKEFLAGS */ |
162 | SP_NOMETA, /* .NOMETA */ | | 163 | SP_NOMETA, /* .NOMETA */ |
163 | SP_NOMETA_CMP, /* .NOMETA_CMP */ | | 164 | SP_NOMETA_CMP, /* .NOMETA_CMP */ |
164 | SP_NOPATH, /* .NOPATH */ | | 165 | SP_NOPATH, /* .NOPATH */ |
165 | SP_NOT, /* Not special */ | | 166 | SP_NOT, /* Not special */ |
166 | SP_NOTPARALLEL, /* .NOTPARALLEL or .NO_PARALLEL */ | | 167 | SP_NOTPARALLEL, /* .NOTPARALLEL or .NO_PARALLEL */ |
167 | SP_NULL, /* .NULL; not mentioned in the manual page */ | | 168 | SP_NULL, /* .NULL; not mentioned in the manual page */ |
168 | SP_OBJDIR, /* .OBJDIR */ | | 169 | SP_OBJDIR, /* .OBJDIR */ |
169 | SP_ORDER, /* .ORDER */ | | 170 | SP_ORDER, /* .ORDER */ |
170 | SP_PARALLEL, /* .PARALLEL; not mentioned in the manual page */ | | 171 | SP_PARALLEL, /* .PARALLEL; not mentioned in the manual page */ |
171 | SP_PATH, /* .PATH or .PATH.suffix */ | | 172 | SP_PATH, /* .PATH or .PATH.suffix */ |
172 | SP_PHONY, /* .PHONY */ | | 173 | SP_PHONY, /* .PHONY */ |
173 | #ifdef POSIX | | 174 | #ifdef POSIX |
174 | SP_POSIX, /* .POSIX; not mentioned in the manual page */ | | 175 | SP_POSIX, /* .POSIX; not mentioned in the manual page */ |
175 | #endif | | 176 | #endif |
176 | SP_PRECIOUS, /* .PRECIOUS */ | | 177 | SP_PRECIOUS, /* .PRECIOUS */ |
177 | SP_SHELL, /* .SHELL */ | | 178 | SP_SHELL, /* .SHELL */ |
178 | SP_SILENT, /* .SILENT */ | | 179 | SP_SILENT, /* .SILENT */ |
179 | SP_SINGLESHELL, /* .SINGLESHELL; not mentioned in the manual page */ | | 180 | SP_SINGLESHELL, /* .SINGLESHELL; not mentioned in the manual page */ |
180 | SP_STALE, /* .STALE */ | | 181 | SP_STALE, /* .STALE */ |
181 | SP_SUFFIXES, /* .SUFFIXES */ | | 182 | SP_SUFFIXES, /* .SUFFIXES */ |
182 | SP_WAIT, /* .WAIT */ | | 183 | SP_WAIT /* .WAIT */ |
183 | SP_ATTRIBUTE /* Generic attribute */ | | | |
184 | } ParseSpecial; | | 184 | } ParseSpecial; |
185 | | | 185 | |
186 | typedef List SearchPathList; | | 186 | typedef List SearchPathList; |
187 | typedef ListNode SearchPathListNode; | | 187 | typedef ListNode SearchPathListNode; |
188 | | | 188 | |
189 | /* result data */ | | 189 | /* result data */ |
190 | | | 190 | |
191 | /* | | 191 | /* |
192 | * The main target to create. This is the first target on the first | | 192 | * The main target to create. This is the first target on the first |
193 | * dependency line in the first makefile. | | 193 | * dependency line in the first makefile. |
194 | */ | | 194 | */ |
195 | static GNode *mainNode; | | 195 | static GNode *mainNode; |
196 | | | 196 | |