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
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
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/>. */
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
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 #ifndef CONFIG_NO_DEFAULT_SUFFIXES
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";
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";
53 #else /* CONFIG_NO_DEFAULT_SUFFIXES */
55 #endif /* CONFIG_NO_DEFAULT_SUFFIXES */
57 static struct pspec default_pattern_rules
[] =
59 #ifndef CONFIG_NO_DEFAULT_PATTERN_RULES
61 "$(AR) $(ARFLAGS) $@ $<" },
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. */
71 "@rm -f $@ \n cp $< $@" },
73 /* Syntax is "ctangle foo.w foo.ch foo.c". */
76 { "%.tex", "%.w %.ch",
78 #endif /* !CONFIG_NO_DEFAULT_PATTERN_RULES */
82 static struct pspec default_terminal_rules
[] =
84 #ifndef CONFIG_NO_DEFAULT_TERMINAL_RULES
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)" },
97 /* ain't no SCCS on vms */
109 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
111 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
113 #endif /* !CONFIG_NO_DEFAULT_TERMINAL_RULES */
117 static char *default_suffix_rules
[] =
119 #ifndef CONFIG_NO_DEFAULT_SUFFIX_RULES
122 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
124 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
126 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
128 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
131 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
133 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
135 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
138 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
140 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
146 "$(COMPILE.mar) /obj=$@ $<",
148 "$(COMPILE.s) /obj=$@ $<",
150 "$(COMPILE.s) /obj=$@ $<",
152 "$(COMPILE.c)/prep /list=$@ $<",
154 "$(COMPILE.c)/noobj/machine /list=$@ $<",
156 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
158 "$(COMPILE.c) /obj=$@ $<",
160 "$(COMPILE.cc)/prep /list=$@ $<",
162 "$(COMPILE.cc)/noobj/machine /list=$@ $<",
164 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
166 "$(COMPILE.cc) /obj=$@ $<",
168 "$(COMPILE.cxx) /obj=$@ $<",
170 "$(COMPILE.for) /obj=$@ $<",
172 "$(COMPILE.pas) /obj=$@ $<",
175 "$(YACC.y) $< \n rename y_tab.c $@",
177 "$(LEX.l) $< \n rename lexyy.c $@",
188 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
190 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
192 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
194 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
196 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
198 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
200 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
202 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
204 "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
206 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
208 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
210 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
212 "$(COMPILE.mod) -o $@ -e $@ $^",
215 "$(COMPILE.def) -o $@ $<",
218 "cat $< >$@ \n chmod a+x $@",
221 "$(COMPILE.s) -o $@ $<",
223 "$(COMPILE.S) -o $@ $<",
225 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
227 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
229 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
231 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
233 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
235 "$(COMPILE.m) $(OUTPUT_OPTION) $<",
237 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
239 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
241 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
243 "$(COMPILE.mod) -o $@ $<",
249 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
251 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
254 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
258 "$(YACC.y) $< \n mv -f y.tab.c $@",
260 "$(YACC.y) $< \n mv -f y_tab.c $@",
263 "@$(RM) $@ \n $(LEX.l) $< > $@",
265 "$(YACC.m) $< \n mv -f y.tab.c $@",
267 "@$(RM) $@ \n $(LEX.m) $< > $@",
270 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
272 "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
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? */
277 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
280 "$(PREPROCESS.S) $< > $@",
283 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
286 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
289 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
295 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
298 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
301 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
304 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
310 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
316 #endif /* !CONFIG_NO_DEFAULT_SUFFIX_RULES */
320 static const char *default_variables
[] =
322 #ifndef CONFIG_NO_DEFAULT_VARIABLES
334 "ARFLAGS", "/replace",
344 "ECHO", "write sys$$output \"",
354 "CPP", "$(CC) /preprocess_only",
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. */
359 "F77FLAGS", "$(FFLAGS)",
363 "YACC", "bison/yacc",
364 "YFLAGS", "/Define/Verbose",
366 "MAKEINFO", "makeinfo",
368 "TEXINDEX", "texindex",
370 "RM", "delete/nolog",
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",
387 "LINK.obj", "$(LD) $(LDFLAGS)",
388 #ifndef GCC_IS_NATIVE
389 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
390 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
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)",
402 "MV", "rename/new_version",
413 "CXX", "gpp", /* g++ is an invalid name on MSDOS */
416 # endif /* __MSDOS__ */
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) $< $@)",
433 "CF77PP", "/lib/cpp",
437 #else /* Not CRAY. */
445 #endif /* __convex__ */
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. */
450 "F77FLAGS", "$(FFLAGS)",
474 "YACC", "yacc", /* Or "bison -y" */
476 "MAKEINFO", "makeinfo",
478 "TEXI2DVI", "texi2dvi",
482 "CTANGLE", "ctangle",
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)",
520 #ifndef NO_MINUS_C_MINUS_O
521 "OUTPUT_OPTION", "-o $@",
524 #ifdef SCCS_GET_MINUS_G
525 "SCCS_OUTPUT_OPTION", "-G$@",
529 ".LIBPATTERNS", "%.lib",
532 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
534 ".LIBPATTERNS", "lib%.so lib%.a",
539 #endif /* !CONFIG_NO_DEFAULT_VARIABLES */
543 /* Set up the default .SUFFIXES list. */
546 set_default_suffixes (void)
548 suffix_file
= enter_file (strcache_add (".SUFFIXES"));
550 if (no_builtin_rules_flag
)
551 define_variable ("SUFFIXES", 8, "", o_default
, 0);
554 char *p
= default_suffixes
;
555 suffix_file
->deps
= (struct dep
*)
556 #ifndef CONFIG_WITH_ALLOC_CACHES
557 multi_glob (parse_file_seq (&p
, '\0', sizeof (struct dep
), 1),
558 sizeof (struct dep
));
560 multi_glob (parse_file_seq (&p
, '\0', &dep_cache
, 1), &dep_cache
);
562 define_variable ("SUFFIXES", 8, default_suffixes
, o_default
, 0);
566 /* Enter the default suffix rules as file rules. This used to be done in
567 install_default_implicit_rules, but that loses because we want the
568 suffix rules installed before reading makefiles, and the pattern rules
572 install_default_suffix_rules (void)
576 if (no_builtin_rules_flag
)
579 for (s
= default_suffix_rules
; *s
!= 0; s
+= 2)
581 struct file
*f
= enter_file (strcache_add (s
[0]));
582 /* Don't clobber cmds given in a makefile if there were any. */
585 #ifndef CONFIG_WITH_ALLOC_CACHES
586 f
->cmds
= xmalloc (sizeof (struct commands
));
588 f
->cmds
= alloccache_alloc (&commands_cache
);
590 f
->cmds
->fileinfo
.filenm
= 0;
591 f
->cmds
->commands
= s
[1];
592 f
->cmds
->command_lines
= 0;
593 #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS
594 f
->cmds
->refs
= 1000;
601 /* Install the default pattern rules. */
604 install_default_implicit_rules (void)
608 if (no_builtin_rules_flag
)
611 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
612 install_pattern_rule (p
, 0);
614 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
615 install_pattern_rule (p
, 1);
619 define_default_variables (void)
623 if (no_builtin_variables_flag
)
626 for (s
= default_variables
; *s
!= 0; s
+= 2)
627 define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);