VirtualBox

source: kBuild/trunk/src/gmake/default.c@ 311

Last change on this file since 311 was 287, checked in by bird, 20 years ago

join + optimizations.

  • Property svn:eol-style set to native
File size: 16.1 KB
Line 
1/* Data base of default implicit rules for GNU Make.
2Copyright (C) 1988,89,90,91,92,93,94,95,96 Free Software Foundation, Inc.
3This file is part of GNU Make.
4
5GNU Make is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2, or (at your option)
8any later version.
9
10GNU Make is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with GNU Make; see the file COPYING. If not, write to
17the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18Boston, MA 02111-1307, USA. */
19
20#include "make.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"
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
39static char default_suffixes[]
40#ifndef CONFIG_NO_DEFAULT_SUFFIXES
41#ifdef VMS
42 = ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
43.s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
44.w .ch .cweb .web .com .sh .elc .el";
45#elif defined(__EMX__)
46 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
47.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
48.w .ch .web .sh .elc .el .obj .exe .dll .lib";
49#else
50 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
51.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
52.w .ch .web .sh .elc .el";
53#endif
54#else /* CONFIG_NO_DEFAULT_SUFFIXES */
55 = "";
56#endif /* CONFIG_NO_DEFAULT_SUFFIXES */
57
58static struct pspec default_pattern_rules[] =
59 {
60#ifndef CONFIG_NO_DEFAULT_PATTERN_RULES
61 { "(%)", "%",
62 "$(AR) $(ARFLAGS) $@ $<" },
63
64 /* The X.out rules are only in BSD's default set because
65 BSD Make has no null-suffix rules, so `foo.out' and
66 `foo' are the same thing. */
67#ifdef VMS
68 { "%.exe", "%",
69 "copy $< $@" },
70#else
71 { "%.out", "%",
72 "@rm -f $@ \n cp $< $@" },
73#endif
74 /* Syntax is "ctangle foo.w foo.ch foo.c". */
75 { "%.c", "%.w %.ch",
76 "$(CTANGLE) $^ $@" },
77 { "%.tex", "%.w %.ch",
78 "$(CWEAVE) $^ $@" },
79#endif /* !CONFIG_NO_DEFAULT_PATTERN_RULES */
80 { 0, 0, 0 }
81 };
82
83static struct pspec default_terminal_rules[] =
84 {
85#ifndef CONFIG_NO_DEFAULT_TERMINAL_RULES
86#ifdef VMS
87 /* RCS. */
88 { "%", "%$$5lv", /* Multinet style */
89 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
90 { "%", "[.$$rcs]%$$5lv", /* Multinet style */
91 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
92 { "%", "%_v", /* Normal style */
93 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
94 { "%", "[.rcs]%_v", /* Normal style */
95 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
96
97 /* SCCS. */
98 /* ain't no SCCS on vms */
99#else
100 /* RCS. */
101 { "%", "%,v",
102 "$(CHECKOUT,v)" },
103 { "%", "RCS/%,v",
104 "$(CHECKOUT,v)" },
105 { "%", "RCS/%",
106 "$(CHECKOUT,v)" },
107
108 /* SCCS. */
109 { "%", "s.%",
110 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
111 { "%", "SCCS/s.%",
112 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
113#endif /* !VMS */
114#endif /* !CONFIG_NO_DEFAULT_TERMINAL_RULES */
115 { 0, 0, 0 }
116 };
117
118static char *default_suffix_rules[] =
119 {
120#ifndef CONFIG_NO_DEFAULT_SUFFIX_RULES
121#ifdef VMS
122 ".obj.exe",
123 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
124 ".mar.exe",
125 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
126 ".s.exe",
127 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
128 ".c.exe",
129 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
130 ".cc.exe",
131#ifdef GCC_IS_NATIVE
132 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
133#else
134 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
135 ".cxx.exe",
136 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
137#endif
138 ".for.exe",
139 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
140 ".pas.exe",
141 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
142
143 ".com",
144 "copy $< >$@",
145
146 ".mar.obj",
147 "$(COMPILE.mar) /obj=$@ $<",
148 ".s.obj",
149 "$(COMPILE.s) /obj=$@ $<",
150 ".ss.obj",
151 "$(COMPILE.s) /obj=$@ $<",
152 ".c.i",
153 "$(COMPILE.c)/prep /list=$@ $<",
154 ".c.s",
155 "$(COMPILE.c)/noobj/machine /list=$@ $<",
156 ".i.s",
157 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
158 ".c.obj",
159 "$(COMPILE.c) /obj=$@ $<",
160 ".cc.ii",
161 "$(COMPILE.cc)/prep /list=$@ $<",
162 ".cc.ss",
163 "$(COMPILE.cc)/noobj/machine /list=$@ $<",
164 ".ii.ss",
165 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
166 ".cc.obj",
167 "$(COMPILE.cc) /obj=$@ $<",
168 ".cxx.obj",
169 "$(COMPILE.cxx) /obj=$@ $<",
170 ".for.obj",
171 "$(COMPILE.for) /obj=$@ $<",
172 ".pas.obj",
173 "$(COMPILE.pas) /obj=$@ $<",
174
175 ".y.c",
176 "$(YACC.y) $< \n rename y_tab.c $@",
177 ".l.c",
178 "$(LEX.l) $< \n rename lexyy.c $@",
179
180 ".texinfo.info",
181 "$(MAKEINFO) $<",
182
183 ".tex.dvi",
184 "$(TEX) $<",
185
186#else /* ! VMS */
187
188 ".o",
189 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
190 ".s",
191 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
192 ".S",
193 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
194 ".c",
195 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
196 ".cc",
197 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
198 ".C",
199 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
200 ".cpp",
201 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
202 ".f",
203 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
204 ".p",
205 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
206 ".F",
207 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
208 ".r",
209 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
210 ".mod",
211 "$(COMPILE.mod) -o $@ -e $@ $^",
212
213 ".def.sym",
214 "$(COMPILE.def) -o $@ $<",
215
216 ".sh",
217 "cat $< >$@ \n chmod a+x $@",
218
219 ".s.o",
220 "$(COMPILE.s) -o $@ $<",
221 ".S.o",
222 "$(COMPILE.S) -o $@ $<",
223 ".c.o",
224 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
225 ".cc.o",
226 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
227 ".C.o",
228 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
229 ".cpp.o",
230 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
231 ".f.o",
232 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
233 ".p.o",
234 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
235 ".F.o",
236 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
237 ".r.o",
238 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
239 ".mod.o",
240 "$(COMPILE.mod) -o $@ $<",
241
242 ".c.ln",
243 "$(LINT.c) -C$* $<",
244 ".y.ln",
245#ifndef __MSDOS__
246 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
247#else
248 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
249#endif
250 ".l.ln",
251 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
252
253 ".y.c",
254#ifndef __MSDOS__
255 "$(YACC.y) $< \n mv -f y.tab.c $@",
256#else
257 "$(YACC.y) $< \n mv -f y_tab.c $@",
258#endif
259 ".l.c",
260 "@$(RM) $@ \n $(LEX.l) $< > $@",
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%
268 directive in $*.l, but in that case why were you
269 trying to make $*.r anyway? */
270 ".l.r",
271 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
272
273 ".S.s",
274 "$(PREPROCESS.S) $< > $@",
275
276 ".texinfo.info",
277 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
278
279 ".texi.info",
280 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
281
282 ".txinfo.info",
283 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
284
285 ".tex.dvi",
286 "$(TEX) $<",
287
288 ".texinfo.dvi",
289 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
290
291 ".texi.dvi",
292 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
293
294 ".txinfo.dvi",
295 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
296
297 ".w.c",
298 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
299
300 ".web.p",
301 "$(TANGLE) $<",
302
303 ".w.tex",
304 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
305
306 ".web.tex",
307 "$(WEAVE) $<",
308
309#endif /* !VMS */
310#endif /* !CONFIG_NO_DEFAULT_SUFFIX_RULES */
311 0, 0,
312 };
313
314static char *default_variables[] =
315 {
316#ifndef CONFIG_NO_DEFAULT_VARIABLES
317#ifdef VMS
318#ifdef __ALPHA
319 "ARCH", "ALPHA",
320#endif
321#ifdef __ia64
322 "ARCH", "IA64",
323#endif
324#ifdef __VAX
325 "ARCH", "VAX",
326#endif
327 "AR", "library/obj",
328 "ARFLAGS", "/replace",
329 "AS", "macro",
330 "MACRO", "macro",
331#ifdef GCC_IS_NATIVE
332 "CC", "gcc",
333#else
334 "CC", "cc",
335#endif
336 "CD", "builtin_cd",
337 "MAKE", "make",
338 "ECHO", "write sys$$output \"",
339#ifdef GCC_IS_NATIVE
340 "C++", "gcc/plus",
341 "CXX", "gcc/plus",
342#else
343 "C++", "cxx",
344 "CXX", "cxx",
345 "CXXLD", "cxxlink",
346#endif
347 "CO", "co",
348 "CPP", "$(CC) /preprocess_only",
349 "FC", "fortran",
350 /* System V uses these, so explicit rules using them should work.
351 However, there is no way to make implicit rules use them and FC. */
352 "F77", "$(FC)",
353 "F77FLAGS", "$(FFLAGS)",
354 "LD", "link",
355 "LEX", "lex",
356 "PC", "pascal",
357 "YACC", "bison/yacc",
358 "YFLAGS", "/Define/Verbose",
359 "BISON", "bison",
360 "MAKEINFO", "makeinfo",
361 "TEX", "tex",
362 "TEXINDEX", "texindex",
363
364 "RM", "delete/nolog",
365
366 "CSTARTUP", "",
367#ifdef GCC_IS_NATIVE
368 "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
369 "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
370 "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
371 "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
372 "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
373#else
374 "CRT0", "",
375 "CXXSTARTUP", "",
376 "CXXRT0", "",
377 "LXLIBS", "",
378 "LDLIBS", "",
379#endif
380
381 "LINK.obj", "$(LD) $(LDFLAGS)",
382#ifndef GCC_IS_NATIVE
383 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
384 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
385#endif
386 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
387 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
388 "YACC.y", "$(YACC) $(YFLAGS)",
389 "LEX.l", "$(LEX) $(LFLAGS)",
390 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
391 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
392 "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
393 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
394 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
395
396 "MV", "rename/new_version",
397 "CP", "copy",
398
399#else /* !VMS */
400
401 "AR", "ar",
402 "ARFLAGS", "rv",
403 "AS", "as",
404#ifdef GCC_IS_NATIVE
405 "CC", "gcc",
406# ifdef __MSDOS__
407 "CXX", "gpp", /* g++ is an invalid name on MSDOS */
408# else
409 "CXX", "gcc",
410# endif /* __MSDOS__ */
411#else
412 "CC", "cc",
413 "CXX", "g++",
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.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
482 "COMPILE.C", "$(COMPILE.cc)",
483 "COMPILE.cpp", "$(COMPILE.cc)",
484 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
485 "LINK.C", "$(LINK.cc)",
486 "LINK.cpp", "$(LINK.cc)",
487 "YACC.y", "$(YACC) $(YFLAGS)",
488 "LEX.l", "$(LEX) $(LFLAGS) -t",
489 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
490 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
491 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
492 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
493 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
494 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
495 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
496 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
497 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
498 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
499 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
500 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
501 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
502 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
503 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
504 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
505 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
506 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
507
508#ifndef NO_MINUS_C_MINUS_O
509 "OUTPUT_OPTION", "-o $@",
510#endif
511
512#ifdef SCCS_GET_MINUS_G
513 "SCCS_OUTPUT_OPTION", "-G$@",
514#endif
515
516#ifdef _AMIGA
517 ".LIBPATTERNS", "%.lib",
518#else
519#ifdef __MSDOS__
520 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
521#else
522 ".LIBPATTERNS", "lib%.so lib%.a",
523#endif
524#endif
525
526#endif /* !VMS */
527#endif /* !CONFIG_NO_DEFAULT_VARIABLES */
528 0, 0
529 };
530
531
532/* Set up the default .SUFFIXES list. */
533
534void
535set_default_suffixes (void)
536{
537 suffix_file = enter_file (".SUFFIXES");
538
539 if (no_builtin_rules_flag)
540 (void) define_variable ("SUFFIXES", 8, "", o_default, 0);
541 else
542 {
543 char *p = default_suffixes;
544 suffix_file->deps = (struct dep *)
545 multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1),
546 sizeof (struct dep));
547 (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);
548 }
549}
550
551/* Enter the default suffix rules as file rules. This used to be done in
552 install_default_implicit_rules, but that loses because we want the
553 suffix rules installed before reading makefiles, and thee pattern rules
554 installed after. */
555
556void
557install_default_suffix_rules (void)
558{
559 register char **s;
560
561 if (no_builtin_rules_flag)
562 return;
563
564 for (s = default_suffix_rules; *s != 0; s += 2)
565 {
566 register struct file *f = enter_file (s[0]);
567 /* Don't clobber cmds given in a makefile if there were any. */
568 if (f->cmds == 0)
569 {
570 f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
571 f->cmds->fileinfo.filenm = 0;
572 f->cmds->commands = s[1];
573 f->cmds->command_lines = 0;
574 }
575 }
576}
577
578
579/* Install the default pattern rules. */
580
581void
582install_default_implicit_rules (void)
583{
584 register struct pspec *p;
585
586 if (no_builtin_rules_flag)
587 return;
588
589 for (p = default_pattern_rules; p->target != 0; ++p)
590 install_pattern_rule (p, 0);
591
592 for (p = default_terminal_rules; p->target != 0; ++p)
593 install_pattern_rule (p, 1);
594}
595
596void
597define_default_variables (void)
598{
599 register char **s;
600
601 if (no_builtin_variables_flag)
602 return;
603
604 for (s = default_variables; *s != 0; s += 2)
605 (void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
606}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette