1 | /* Data base of default implicit rules for GNU Make.
|
---|
2 | Copyright (C) 1988-2016 Free Software Foundation, Inc.
|
---|
3 | This file is part of GNU Make.
|
---|
4 |
|
---|
5 | GNU Make is free software; you can redistribute it and/or modify it under the
|
---|
6 | terms of the GNU General Public License as published by the Free Software
|
---|
7 | Foundation; either version 3 of the License, or (at your option) any later
|
---|
8 | version.
|
---|
9 |
|
---|
10 | GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
---|
12 | A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License along with
|
---|
15 | this program. If not, see <http://www.gnu.org/licenses/>. */
|
---|
16 |
|
---|
17 | #include "makeint.h"
|
---|
18 |
|
---|
19 | #include <assert.h>
|
---|
20 |
|
---|
21 | #include "filedef.h"
|
---|
22 | #include "variable.h"
|
---|
23 | #include "rule.h"
|
---|
24 | #include "dep.h"
|
---|
25 | #include "job.h"
|
---|
26 | #include "commands.h"
|
---|
27 |
|
---|
28 | /* Define GCC_IS_NATIVE if gcc is the native development environment on
|
---|
29 | your system (gcc/bison/flex vs cc/yacc/lex). */
|
---|
30 | #if defined(__MSDOS__) || defined(__EMX__)
|
---|
31 | # define GCC_IS_NATIVE
|
---|
32 | #endif
|
---|
33 |
|
---|
34 |
|
---|
35 | /* This is the default list of suffixes for suffix rules.
|
---|
36 | '.s' must come last, so that a '.o' file will be made from
|
---|
37 | a '.c' or '.p' or ... file rather than from a .s file. */
|
---|
38 |
|
---|
39 | static char default_suffixes[]
|
---|
40 | #ifdef VMS
|
---|
41 | /* VMS should include all UNIX/POSIX + some VMS extensions */
|
---|
42 | = ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \
|
---|
43 | .for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \
|
---|
44 | .tex .texinfo .texi .txinfo .mem .hlp .brn .rnh .rno .rnt .rnx .w .ch .cweb \
|
---|
45 | .web .com .sh .elc .el";
|
---|
46 | #elif defined(__EMX__)
|
---|
47 | = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
|
---|
48 | .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
|
---|
49 | .w .ch .web .sh .elc .el .obj .exe .dll .lib";
|
---|
50 | #else
|
---|
51 | = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
|
---|
52 | .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
|
---|
53 | .w .ch .web .sh .elc .el";
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | static struct pspec default_pattern_rules[] =
|
---|
57 | {
|
---|
58 | #ifdef VMS
|
---|
59 | { "(%)", "%",
|
---|
60 | "@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/"
|
---|
61 | "$(or "
|
---|
62 | "$(patsubst %,TEXT,$(filter %.tlb %.TLB,$@)),"
|
---|
63 | "$(patsubst %,HELP,$(filter %.hlb %.HLB,$@)),"
|
---|
64 | "$(patsubst %,MACRO,$(filter %.mlb %.MLB,$@)),"
|
---|
65 | "$(and "
|
---|
66 | "$(patsubst %,SHARE,$(filter %.olb %.OLB,$@)),"
|
---|
67 | "$(patsubst %,SHARE,$(filter %.exe %.EXE,$<))),"
|
---|
68 | "OBJECT)"
|
---|
69 | " $@\n"
|
---|
70 | "$(AR) $(ARFLAGS) $@ $<" },
|
---|
71 |
|
---|
72 | #else
|
---|
73 | { "(%)", "%",
|
---|
74 | "$(AR) $(ARFLAGS) $@ $<" },
|
---|
75 | #endif
|
---|
76 | /* The X.out rules are only in BSD's default set because
|
---|
77 | BSD Make has no null-suffix rules, so 'foo.out' and
|
---|
78 | 'foo' are the same thing. */
|
---|
79 | #ifdef VMS
|
---|
80 | { "%.exe", "%",
|
---|
81 | "$(CP) $< $@" },
|
---|
82 |
|
---|
83 | #endif
|
---|
84 | { "%.out", "%",
|
---|
85 | "@rm -f $@ \n cp $< $@" },
|
---|
86 |
|
---|
87 | /* Syntax is "ctangle foo.w foo.ch foo.c". */
|
---|
88 | { "%.c", "%.w %.ch",
|
---|
89 | "$(CTANGLE) $^ $@" },
|
---|
90 | { "%.tex", "%.w %.ch",
|
---|
91 | "$(CWEAVE) $^ $@" },
|
---|
92 |
|
---|
93 | { 0, 0, 0 }
|
---|
94 | };
|
---|
95 |
|
---|
96 | static struct pspec default_terminal_rules[] =
|
---|
97 | {
|
---|
98 | #ifdef VMS
|
---|
99 |
|
---|
100 | /* RCS. */
|
---|
101 | { "%", "%$$5lv", /* Multinet style */
|
---|
102 | "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
|
---|
103 | { "%", "[.$$rcs]%$$5lv", /* Multinet style */
|
---|
104 | "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
|
---|
105 | { "%", "%_v", /* Normal style */
|
---|
106 | "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
|
---|
107 | { "%", "[.rcs]%_v", /* Normal style */
|
---|
108 | "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
|
---|
109 |
|
---|
110 | /* SCCS. */
|
---|
111 | /* ain't no SCCS on vms */
|
---|
112 |
|
---|
113 | #else
|
---|
114 | /* RCS. */
|
---|
115 | { "%", "%,v",
|
---|
116 | "$(CHECKOUT,v)" },
|
---|
117 | { "%", "RCS/%,v",
|
---|
118 | "$(CHECKOUT,v)" },
|
---|
119 | { "%", "RCS/%",
|
---|
120 | "$(CHECKOUT,v)" },
|
---|
121 |
|
---|
122 | /* SCCS. */
|
---|
123 | { "%", "s.%",
|
---|
124 | "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
---|
125 | { "%", "SCCS/s.%",
|
---|
126 | "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
|
---|
127 | #endif /* !VMS */
|
---|
128 | { 0, 0, 0 }
|
---|
129 | };
|
---|
130 |
|
---|
131 | static const char *default_suffix_rules[] =
|
---|
132 | {
|
---|
133 | #ifdef VMS
|
---|
134 | ".o",
|
---|
135 | "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
136 | ".obj",
|
---|
137 | "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
138 | ".s",
|
---|
139 | "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
140 | ".S",
|
---|
141 | "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
142 | ".c",
|
---|
143 | "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
144 | ".cc",
|
---|
145 | "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
146 | ".C",
|
---|
147 | "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
148 | ".cpp",
|
---|
149 | "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
150 | ".f",
|
---|
151 | "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
152 | ".m",
|
---|
153 | "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
154 | ".p",
|
---|
155 | "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
156 | ".F",
|
---|
157 | "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
158 | ".r",
|
---|
159 | "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
160 | ".mod",
|
---|
161 | "$(COMPILE.mod) -o $@ -e $@ $^",
|
---|
162 |
|
---|
163 | ".def.sym",
|
---|
164 | "$(COMPILE.def) -o $@ $<",
|
---|
165 |
|
---|
166 | ".sh",
|
---|
167 | "copy $< >$@",
|
---|
168 |
|
---|
169 | ".obj.exe",
|
---|
170 | "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
|
---|
171 | ".mar.exe",
|
---|
172 | "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
|
---|
173 | ".s.o",
|
---|
174 | "$(COMPILE.s) -o $@ $<",
|
---|
175 | ".s.exe",
|
---|
176 | "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
|
---|
177 | ".c.exe",
|
---|
178 | "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
|
---|
179 | ".cc.exe",
|
---|
180 | #ifdef GCC_IS_NATIVE
|
---|
181 | "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
|
---|
182 | #else
|
---|
183 | "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
|
---|
184 | ".cxx.exe",
|
---|
185 | "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
|
---|
186 | #endif
|
---|
187 | ".for.exe",
|
---|
188 | "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
---|
189 | ".pas.exe",
|
---|
190 | "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
|
---|
191 |
|
---|
192 | ".com",
|
---|
193 | "copy $< >$@",
|
---|
194 |
|
---|
195 | ".mar.obj",
|
---|
196 | "$(COMPILE.mar) /obj=$@ $<",
|
---|
197 | ".s.obj",
|
---|
198 | "$(COMPILE.s) /obj=$@ $<",
|
---|
199 | ".ss.obj",
|
---|
200 | "$(COMPILE.s) /obj=$@ $<",
|
---|
201 | ".c.i",
|
---|
202 | "$(COMPILE.c)/prep /list=$@ $<",
|
---|
203 | ".c.s",
|
---|
204 | "$(COMPILE.c)/noobj/machine /list=$@ $<",
|
---|
205 | ".i.s",
|
---|
206 | "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
|
---|
207 | ".c.obj",
|
---|
208 | "$(COMPILE.c) /obj=$@ $<",
|
---|
209 | ".c.o",
|
---|
210 | "$(COMPILE.c) /obj=$@ $<",
|
---|
211 | ".cc.ii",
|
---|
212 | "$(COMPILE.cc)/prep /list=$@ $<",
|
---|
213 | ".cc.ss",
|
---|
214 | "$(COMPILE.cc)/noobj/machine /list=$@ $<",
|
---|
215 | ".ii.ss",
|
---|
216 | "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
|
---|
217 | ".cc.obj",
|
---|
218 | "$(COMPILE.cc) /obj=$@ $<",
|
---|
219 | ".cc.o",
|
---|
220 | "$(COMPILE.cc) /obj=$@ $<",
|
---|
221 | ".cxx.obj",
|
---|
222 | "$(COMPILE.cxx) /obj=$@ $<",
|
---|
223 | ".cxx.o",
|
---|
224 | "$(COMPILE.cxx) /obj=$@ $<",
|
---|
225 | ".for.obj",
|
---|
226 | "$(COMPILE.for) /obj=$@ $<",
|
---|
227 | ".for.o",
|
---|
228 | "$(COMPILE.for) /obj=$@ $<",
|
---|
229 | ".pas.obj",
|
---|
230 | "$(COMPILE.pas) /obj=$@ $<",
|
---|
231 | ".pas.o",
|
---|
232 | "$(COMPILE.pas) /obj=$@ $<",
|
---|
233 |
|
---|
234 | ".y.c",
|
---|
235 | "$(YACC.y) $< \n rename y_tab.c $@",
|
---|
236 | ".l.c",
|
---|
237 | "$(LEX.l) $< \n rename lexyy.c $@",
|
---|
238 |
|
---|
239 | ".texinfo.info",
|
---|
240 | "$(MAKEINFO) $<",
|
---|
241 |
|
---|
242 | ".tex.dvi",
|
---|
243 | "$(TEX) $<",
|
---|
244 |
|
---|
245 | ".cpp.o",
|
---|
246 | "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
|
---|
247 | ".f.o",
|
---|
248 | "$(COMPILE.f) $(OUTPUT_OPTION) $<",
|
---|
249 | ".m.o",
|
---|
250 | "$(COMPILE.m) $(OUTPUT_OPTION) $<",
|
---|
251 | ".p.o",
|
---|
252 | "$(COMPILE.p) $(OUTPUT_OPTION) $<",
|
---|
253 | ".r.o",
|
---|
254 | "$(COMPILE.r) $(OUTPUT_OPTION) $<",
|
---|
255 | ".mod.o",
|
---|
256 | "$(COMPILE.mod) -o $@ $<",
|
---|
257 |
|
---|
258 | ".c.ln",
|
---|
259 | "$(LINT.c) -C$* $<",
|
---|
260 | ".y.ln",
|
---|
261 | "$(YACC.y) $< \n rename y_tab.c $@",
|
---|
262 |
|
---|
263 | ".l.ln",
|
---|
264 | "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
|
---|
265 |
|
---|
266 | #else /* ! VMS */
|
---|
267 |
|
---|
268 | ".o",
|
---|
269 | "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
270 | ".s",
|
---|
271 | "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
272 | ".S",
|
---|
273 | "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
274 | ".c",
|
---|
275 | "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
276 | ".cc",
|
---|
277 | "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
278 | ".C",
|
---|
279 | "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
280 | ".cpp",
|
---|
281 | "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
282 | ".f",
|
---|
283 | "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
284 | ".m",
|
---|
285 | "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
286 | ".p",
|
---|
287 | "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
288 | ".F",
|
---|
289 | "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
290 | ".r",
|
---|
291 | "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
|
---|
292 | ".mod",
|
---|
293 | "$(COMPILE.mod) -o $@ -e $@ $^",
|
---|
294 |
|
---|
295 | ".def.sym",
|
---|
296 | "$(COMPILE.def) -o $@ $<",
|
---|
297 |
|
---|
298 | ".sh",
|
---|
299 | "cat $< >$@ \n chmod a+x $@",
|
---|
300 |
|
---|
301 | ".s.o",
|
---|
302 | "$(COMPILE.s) -o $@ $<",
|
---|
303 | ".S.o",
|
---|
304 | "$(COMPILE.S) -o $@ $<",
|
---|
305 | ".c.o",
|
---|
306 | "$(COMPILE.c) $(OUTPUT_OPTION) $<",
|
---|
307 | ".cc.o",
|
---|
308 | "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
|
---|
309 | ".C.o",
|
---|
310 | "$(COMPILE.C) $(OUTPUT_OPTION) $<",
|
---|
311 | ".cpp.o",
|
---|
312 | "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
|
---|
313 | ".f.o",
|
---|
314 | "$(COMPILE.f) $(OUTPUT_OPTION) $<",
|
---|
315 | ".m.o",
|
---|
316 | "$(COMPILE.m) $(OUTPUT_OPTION) $<",
|
---|
317 | ".p.o",
|
---|
318 | "$(COMPILE.p) $(OUTPUT_OPTION) $<",
|
---|
319 | ".F.o",
|
---|
320 | "$(COMPILE.F) $(OUTPUT_OPTION) $<",
|
---|
321 | ".r.o",
|
---|
322 | "$(COMPILE.r) $(OUTPUT_OPTION) $<",
|
---|
323 | ".mod.o",
|
---|
324 | "$(COMPILE.mod) -o $@ $<",
|
---|
325 |
|
---|
326 | ".c.ln",
|
---|
327 | "$(LINT.c) -C$* $<",
|
---|
328 | ".y.ln",
|
---|
329 | #ifndef __MSDOS__
|
---|
330 | "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
|
---|
331 | #else
|
---|
332 | "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
|
---|
333 | #endif
|
---|
334 | ".l.ln",
|
---|
335 | "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
|
---|
336 |
|
---|
337 | ".y.c",
|
---|
338 | #ifndef __MSDOS__
|
---|
339 | "$(YACC.y) $< \n mv -f y.tab.c $@",
|
---|
340 | #else
|
---|
341 | "$(YACC.y) $< \n mv -f y_tab.c $@",
|
---|
342 | #endif
|
---|
343 | ".l.c",
|
---|
344 | "@$(RM) $@ \n $(LEX.l) $< > $@",
|
---|
345 | ".ym.m",
|
---|
346 | "$(YACC.m) $< \n mv -f y.tab.c $@",
|
---|
347 | ".lm.m",
|
---|
348 | "@$(RM) $@ \n $(LEX.m) $< > $@",
|
---|
349 |
|
---|
350 | ".F.f",
|
---|
351 | "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
|
---|
352 | ".r.f",
|
---|
353 | "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
|
---|
354 |
|
---|
355 | /* This might actually make lex.yy.c if there's no %R% directive in $*.l,
|
---|
356 | but in that case why were you trying to make $*.r anyway? */
|
---|
357 | ".l.r",
|
---|
358 | "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
|
---|
359 |
|
---|
360 | ".S.s",
|
---|
361 | "$(PREPROCESS.S) $< > $@",
|
---|
362 |
|
---|
363 | ".texinfo.info",
|
---|
364 | "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
---|
365 |
|
---|
366 | ".texi.info",
|
---|
367 | "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
---|
368 |
|
---|
369 | ".txinfo.info",
|
---|
370 | "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
|
---|
371 |
|
---|
372 | ".tex.dvi",
|
---|
373 | "$(TEX) $<",
|
---|
374 |
|
---|
375 | ".texinfo.dvi",
|
---|
376 | "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
---|
377 |
|
---|
378 | ".texi.dvi",
|
---|
379 | "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
---|
380 |
|
---|
381 | ".txinfo.dvi",
|
---|
382 | "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
|
---|
383 |
|
---|
384 | ".w.c",
|
---|
385 | "$(CTANGLE) $< - $@", /* The '-' says there is no '.ch' file. */
|
---|
386 |
|
---|
387 | ".web.p",
|
---|
388 | "$(TANGLE) $<",
|
---|
389 |
|
---|
390 | ".w.tex",
|
---|
391 | "$(CWEAVE) $< - $@", /* The '-' says there is no '.ch' file. */
|
---|
392 |
|
---|
393 | ".web.tex",
|
---|
394 | "$(WEAVE) $<",
|
---|
395 |
|
---|
396 | #endif /* !VMS */
|
---|
397 |
|
---|
398 | 0, 0,
|
---|
399 | };
|
---|
400 |
|
---|
401 | static const char *default_variables[] =
|
---|
402 | {
|
---|
403 | #ifdef VMS
|
---|
404 | #ifdef __ALPHA
|
---|
405 | "ARCH", "ALPHA",
|
---|
406 | #endif
|
---|
407 | #ifdef __ia64
|
---|
408 | "ARCH", "IA64",
|
---|
409 | #endif
|
---|
410 | #ifdef __VAX
|
---|
411 | "ARCH", "VAX",
|
---|
412 | #endif
|
---|
413 | "AR", "library",
|
---|
414 | "LIBRARY", "library",
|
---|
415 | "ARFLAGS", "/replace",
|
---|
416 | "AS", "macro",
|
---|
417 | "MACRO", "macro",
|
---|
418 | #ifdef GCC_IS_NATIVE
|
---|
419 | "CC", "gcc",
|
---|
420 | #else
|
---|
421 | "CC", "cc",
|
---|
422 | #endif
|
---|
423 | "CD", "builtin_cd",
|
---|
424 | "ECHO", "builtin_echo",
|
---|
425 | #ifdef GCC_IS_NATIVE
|
---|
426 | "C++", "gcc/plus",
|
---|
427 | "CXX", "gcc/plus",
|
---|
428 | #else
|
---|
429 | "C++", "cxx",
|
---|
430 | "CXX", "cxx",
|
---|
431 | #ifndef __ia64
|
---|
432 | "CXXLD", "cxxlink",
|
---|
433 | "CXXLINK", "cxxlink",
|
---|
434 | #else
|
---|
435 | /* CXXLINK is not used on VMS/IA64 */
|
---|
436 | "CXXLD", "link",
|
---|
437 | "CXXLINK", "link",
|
---|
438 | #endif
|
---|
439 | #endif
|
---|
440 | "CO", "co",
|
---|
441 | "CPP", "$(CC) /preprocess_only",
|
---|
442 | "FC", "fortran",
|
---|
443 | /* System V uses these, so explicit rules using them should work.
|
---|
444 | However, there is no way to make implicit rules use them and FC. */
|
---|
445 | "F77", "$(FC)",
|
---|
446 | "F77FLAGS", "$(FFLAGS)",
|
---|
447 | "LD", "link",
|
---|
448 | "LEX", "lex",
|
---|
449 | "PC", "pascal",
|
---|
450 | "YACC", "bison/yacc",
|
---|
451 | "YFLAGS", "/Define/Verbose",
|
---|
452 | "BISON", "bison",
|
---|
453 | "MAKEINFO", "makeinfo",
|
---|
454 | "TEX", "tex",
|
---|
455 | "TEXINDEX", "texindex",
|
---|
456 |
|
---|
457 | "RM", "delete/nolog",
|
---|
458 |
|
---|
459 | "CSTARTUP", "",
|
---|
460 | #ifdef GCC_IS_NATIVE
|
---|
461 | "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
|
---|
462 | "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
|
---|
463 | "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
|
---|
464 | "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
|
---|
465 | "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
|
---|
466 | #else
|
---|
467 | "CRT0", "",
|
---|
468 | "CXXSTARTUP", "",
|
---|
469 | "CXXRT0", "",
|
---|
470 | "LXLIBS", "",
|
---|
471 | "LDLIBS", "",
|
---|
472 | #endif
|
---|
473 |
|
---|
474 | "LINK.o", "$(LD) $(LDFLAGS)",
|
---|
475 | "LINK.obj", "$(LD) $(LDFLAGS)",
|
---|
476 | #ifndef GCC_IS_NATIVE
|
---|
477 | "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
|
---|
478 | "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
479 | #endif
|
---|
480 | "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
481 | "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
482 | "COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
483 | "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
484 | "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
485 | "COMPILE.C", "$(COMPILE.cc)",
|
---|
486 | "COMPILE.cpp", "$(COMPILE.cc)",
|
---|
487 | "LINK.C", "$(LINK.cc)",
|
---|
488 | "LINK.cpp", "$(LINK.cc)",
|
---|
489 | "YACC.y", "$(YACC) $(YFLAGS)",
|
---|
490 | "LEX.l", "$(LEX) $(LFLAGS)",
|
---|
491 | "YACC.m", "$(YACC) $(YFLAGS)",
|
---|
492 | "LEX.m", "$(LEX) $(LFLAGS) -t",
|
---|
493 | "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
|
---|
494 | "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
|
---|
495 | "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
496 | "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
497 | "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
498 | "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
|
---|
499 | "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
500 | "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
501 | "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
|
---|
502 | "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
|
---|
503 | "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
504 | "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
505 | "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
|
---|
506 | "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
---|
507 | "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
---|
508 | "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
|
---|
509 | "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
|
---|
510 | "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
|
---|
511 | "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
|
---|
512 | "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
513 |
|
---|
514 | "MV", "rename/new_version",
|
---|
515 | "CP", "copy",
|
---|
516 | ".LIBPATTERNS", "%.olb lib%.a",
|
---|
517 |
|
---|
518 | #else /* !VMS */
|
---|
519 |
|
---|
520 | "AR", "ar",
|
---|
521 | "ARFLAGS", "rv",
|
---|
522 | "AS", "as",
|
---|
523 | #ifdef GCC_IS_NATIVE
|
---|
524 | "CC", "gcc",
|
---|
525 | # ifdef __MSDOS__
|
---|
526 | "CXX", "gpp", /* g++ is an invalid name on MSDOS */
|
---|
527 | # else
|
---|
528 | "CXX", "gcc",
|
---|
529 | # endif /* __MSDOS__ */
|
---|
530 | "OBJC", "gcc",
|
---|
531 | #else
|
---|
532 | "CC", "cc",
|
---|
533 | "CXX", "g++",
|
---|
534 | "OBJC", "cc",
|
---|
535 | #endif
|
---|
536 |
|
---|
537 | /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
|
---|
538 | and to the empty string if $@ does exist. */
|
---|
539 | "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
|
---|
540 | "CO", "co",
|
---|
541 | "COFLAGS", "",
|
---|
542 |
|
---|
543 | "CPP", "$(CC) -E",
|
---|
544 | #ifdef CRAY
|
---|
545 | "CF77PPFLAGS", "-P",
|
---|
546 | "CF77PP", "/lib/cpp",
|
---|
547 | "CFT", "cft77",
|
---|
548 | "CF", "cf77",
|
---|
549 | "FC", "$(CF)",
|
---|
550 | #else /* Not CRAY. */
|
---|
551 | #ifdef _IBMR2
|
---|
552 | "FC", "xlf",
|
---|
553 | #else
|
---|
554 | #ifdef __convex__
|
---|
555 | "FC", "fc",
|
---|
556 | #else
|
---|
557 | "FC", "f77",
|
---|
558 | #endif /* __convex__ */
|
---|
559 | #endif /* _IBMR2 */
|
---|
560 | /* System V uses these, so explicit rules using them should work.
|
---|
561 | However, there is no way to make implicit rules use them and FC. */
|
---|
562 | "F77", "$(FC)",
|
---|
563 | "F77FLAGS", "$(FFLAGS)",
|
---|
564 | #endif /* Cray. */
|
---|
565 | "GET", SCCS_GET,
|
---|
566 | "LD", "ld",
|
---|
567 | #ifdef GCC_IS_NATIVE
|
---|
568 | "LEX", "flex",
|
---|
569 | #else
|
---|
570 | "LEX", "lex",
|
---|
571 | #endif
|
---|
572 | "LINT", "lint",
|
---|
573 | "M2C", "m2c",
|
---|
574 | #ifdef pyr
|
---|
575 | "PC", "pascal",
|
---|
576 | #else
|
---|
577 | #ifdef CRAY
|
---|
578 | "PC", "PASCAL",
|
---|
579 | "SEGLDR", "segldr",
|
---|
580 | #else
|
---|
581 | "PC", "pc",
|
---|
582 | #endif /* CRAY. */
|
---|
583 | #endif /* pyr. */
|
---|
584 | #ifdef GCC_IS_NATIVE
|
---|
585 | "YACC", "bison -y",
|
---|
586 | #else
|
---|
587 | "YACC", "yacc", /* Or "bison -y" */
|
---|
588 | #endif
|
---|
589 | "MAKEINFO", "makeinfo",
|
---|
590 | "TEX", "tex",
|
---|
591 | "TEXI2DVI", "texi2dvi",
|
---|
592 | "WEAVE", "weave",
|
---|
593 | "CWEAVE", "cweave",
|
---|
594 | "TANGLE", "tangle",
|
---|
595 | "CTANGLE", "ctangle",
|
---|
596 |
|
---|
597 | "RM", "rm -f",
|
---|
598 |
|
---|
599 | "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
600 | "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
601 | "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
602 | "COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
603 | "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
604 | "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
605 | #ifndef HAVE_CASE_INSENSITIVE_FS
|
---|
606 | /* On case-insensitive filesystems, treat *.C files as *.c files,
|
---|
607 | to avoid erroneously compiling C sources as C++, which will
|
---|
608 | probably fail. */
|
---|
609 | "COMPILE.C", "$(COMPILE.cc)",
|
---|
610 | #else
|
---|
611 | "COMPILE.C", "$(COMPILE.c)",
|
---|
612 | #endif
|
---|
613 | "COMPILE.cpp", "$(COMPILE.cc)",
|
---|
614 | "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
615 | #ifndef HAVE_CASE_INSENSITIVE_FS
|
---|
616 | "LINK.C", "$(LINK.cc)",
|
---|
617 | #else
|
---|
618 | "LINK.C", "$(LINK.c)",
|
---|
619 | #endif
|
---|
620 | "LINK.cpp", "$(LINK.cc)",
|
---|
621 | "YACC.y", "$(YACC) $(YFLAGS)",
|
---|
622 | "LEX.l", "$(LEX) $(LFLAGS) -t",
|
---|
623 | "YACC.m", "$(YACC) $(YFLAGS)",
|
---|
624 | "LEX.m", "$(LEX) $(LFLAGS) -t",
|
---|
625 | "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
|
---|
626 | "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
627 | "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
628 | "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
629 | "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
|
---|
630 | "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
631 | "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
|
---|
632 | "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
|
---|
633 | "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
|
---|
634 | "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
|
---|
635 | "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
---|
636 | "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
|
---|
637 | "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
|
---|
638 | "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
|
---|
639 | "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
|
---|
640 | "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
|
---|
641 | "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
|
---|
642 | "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
|
---|
643 |
|
---|
644 | #ifndef NO_MINUS_C_MINUS_O
|
---|
645 | "OUTPUT_OPTION", "-o $@",
|
---|
646 | #endif
|
---|
647 |
|
---|
648 | #ifdef SCCS_GET_MINUS_G
|
---|
649 | "SCCS_OUTPUT_OPTION", "-G$@",
|
---|
650 | #endif
|
---|
651 |
|
---|
652 | #if defined(_AMIGA)
|
---|
653 | ".LIBPATTERNS", "%.lib",
|
---|
654 | #elif defined(__MSDOS__)
|
---|
655 | ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
|
---|
656 | #elif defined(__APPLE__)
|
---|
657 | ".LIBPATTERNS", "lib%.dylib lib%.a",
|
---|
658 | #elif defined(__CYGWIN__) || defined(WINDOWS32)
|
---|
659 | ".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll",
|
---|
660 | #else
|
---|
661 | ".LIBPATTERNS", "lib%.so lib%.a",
|
---|
662 | #endif
|
---|
663 |
|
---|
664 | #endif /* !VMS */
|
---|
665 | /* Make this assignment to avoid undefined variable warnings. */
|
---|
666 | "GNUMAKEFLAGS", "",
|
---|
667 | 0, 0
|
---|
668 | };
|
---|
669 | |
---|
670 |
|
---|
671 | /* Set up the default .SUFFIXES list. */
|
---|
672 |
|
---|
673 | void
|
---|
674 | set_default_suffixes (void)
|
---|
675 | {
|
---|
676 | suffix_file = enter_file (strcache_add (".SUFFIXES"));
|
---|
677 | suffix_file->builtin = 1;
|
---|
678 |
|
---|
679 | if (no_builtin_rules_flag)
|
---|
680 | define_variable_cname ("SUFFIXES", "", o_default, 0);
|
---|
681 | else
|
---|
682 | {
|
---|
683 | struct dep *d;
|
---|
684 | const char *p = default_suffixes;
|
---|
685 | suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep),
|
---|
686 | NULL);
|
---|
687 | for (d = suffix_file->deps; d; d = d->next)
|
---|
688 | d->file->builtin = 1;
|
---|
689 |
|
---|
690 | define_variable_cname ("SUFFIXES", default_suffixes, o_default, 0);
|
---|
691 | }
|
---|
692 | }
|
---|
693 |
|
---|
694 | /* Enter the default suffix rules as file rules. This used to be done in
|
---|
695 | install_default_implicit_rules, but that loses because we want the
|
---|
696 | suffix rules installed before reading makefiles, and the pattern rules
|
---|
697 | installed after. */
|
---|
698 |
|
---|
699 | void
|
---|
700 | install_default_suffix_rules (void)
|
---|
701 | {
|
---|
702 | const char **s;
|
---|
703 |
|
---|
704 | if (no_builtin_rules_flag)
|
---|
705 | return;
|
---|
706 |
|
---|
707 | for (s = default_suffix_rules; *s != 0; s += 2)
|
---|
708 | {
|
---|
709 | struct file *f = enter_file (strcache_add (s[0]));
|
---|
710 | /* This function should run before any makefile is parsed. */
|
---|
711 | assert (f->cmds == 0);
|
---|
712 | f->cmds = xmalloc (sizeof (struct commands));
|
---|
713 | f->cmds->fileinfo.filenm = 0;
|
---|
714 | f->cmds->commands = xstrdup (s[1]);
|
---|
715 | f->cmds->command_lines = 0;
|
---|
716 | f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
|
---|
717 | f->builtin = 1;
|
---|
718 | }
|
---|
719 | }
|
---|
720 |
|
---|
721 |
|
---|
722 | /* Install the default pattern rules. */
|
---|
723 |
|
---|
724 | void
|
---|
725 | install_default_implicit_rules (void)
|
---|
726 | {
|
---|
727 | struct pspec *p;
|
---|
728 |
|
---|
729 | if (no_builtin_rules_flag)
|
---|
730 | return;
|
---|
731 |
|
---|
732 | for (p = default_pattern_rules; p->target != 0; ++p)
|
---|
733 | install_pattern_rule (p, 0);
|
---|
734 |
|
---|
735 | for (p = default_terminal_rules; p->target != 0; ++p)
|
---|
736 | install_pattern_rule (p, 1);
|
---|
737 | }
|
---|
738 |
|
---|
739 | void
|
---|
740 | define_default_variables (void)
|
---|
741 | {
|
---|
742 | const char **s;
|
---|
743 |
|
---|
744 | if (no_builtin_variables_flag)
|
---|
745 | return;
|
---|
746 |
|
---|
747 | for (s = default_variables; *s != 0; s += 2)
|
---|
748 | define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
|
---|
749 | }
|
---|
750 |
|
---|
751 | void
|
---|
752 | undefine_default_variables (void)
|
---|
753 | {
|
---|
754 | const char **s;
|
---|
755 |
|
---|
756 | for (s = default_variables; *s != 0; s += 2)
|
---|
757 | undefine_variable_global (s[0], strlen (s[0]), o_default);
|
---|
758 | }
|
---|