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