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