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