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