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.
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
[]
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";
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";
53 static struct pspec default_pattern_rules
[] =
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. */
66 "@rm -f $@ \n cp $< $@" },
68 /* Syntax is "ctangle foo.w foo.ch foo.c". */
71 { "%.tex", "%.w %.ch",
77 static struct pspec default_terminal_rules
[] =
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)" },
91 /* ain't no SCCS on vms */
103 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
105 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
110 static char *default_suffix_rules
[] =
114 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
116 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
118 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
120 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
123 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
125 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
127 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
130 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
132 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
138 "$(COMPILE.mar) /obj=$@ $<",
140 "$(COMPILE.s) /obj=$@ $<",
142 "$(COMPILE.s) /obj=$@ $<",
144 "$(COMPILE.c)/prep /list=$@ $<",
146 "$(COMPILE.c)/noobj/machine /list=$@ $<",
148 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
150 "$(COMPILE.c) /obj=$@ $<",
152 "$(COMPILE.cc)/prep /list=$@ $<",
154 "$(COMPILE.cc)/noobj/machine /list=$@ $<",
156 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
158 "$(COMPILE.cc) /obj=$@ $<",
160 "$(COMPILE.cxx) /obj=$@ $<",
162 "$(COMPILE.for) /obj=$@ $<",
164 "$(COMPILE.pas) /obj=$@ $<",
167 "$(YACC.y) $< \n rename y_tab.c $@",
169 "$(LEX.l) $< \n rename lexyy.c $@",
180 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
182 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
184 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
186 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
188 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
190 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
192 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
194 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
196 "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
198 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
200 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
202 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
204 "$(COMPILE.mod) -o $@ -e $@ $^",
207 "$(COMPILE.def) -o $@ $<",
210 "cat $< >$@ \n chmod a+x $@",
213 "$(COMPILE.s) -o $@ $<",
215 "$(COMPILE.S) -o $@ $<",
217 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
219 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
221 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
223 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
225 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
227 "$(COMPILE.m) $(OUTPUT_OPTION) $<",
229 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
231 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
233 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
235 "$(COMPILE.mod) -o $@ $<",
241 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
243 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
246 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
250 "$(YACC.y) $< \n mv -f y.tab.c $@",
252 "$(YACC.y) $< \n mv -f y_tab.c $@",
255 "@$(RM) $@ \n $(LEX.l) $< > $@",
257 "$(YACC.m) $< \n mv -f y.tab.c $@",
259 "@$(RM) $@ \n $(LEX.m) $< > $@",
262 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
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? */
269 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
272 "$(PREPROCESS.S) $< > $@",
275 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
278 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
281 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
287 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
290 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
293 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
296 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
302 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
312 static const char *default_variables
[] =
325 "ARFLAGS", "/replace",
335 "ECHO", "write sys$$output \"",
345 "CPP", "$(CC) /preprocess_only",
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. */
350 "F77FLAGS", "$(FFLAGS)",
354 "YACC", "bison/yacc",
355 "YFLAGS", "/Define/Verbose",
357 "MAKEINFO", "makeinfo",
359 "TEXINDEX", "texindex",
361 "RM", "delete/nolog",
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",
378 "LINK.obj", "$(LD) $(LDFLAGS)",
379 #ifndef GCC_IS_NATIVE
380 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
381 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
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",
404 "CXX", "gpp", /* g++ is an invalid name on MSDOS */
407 # endif /* __MSDOS__ */
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) $< $@)",
424 "CF77PP", "/lib/cpp",
428 #else /* Not CRAY. */
436 #endif /* __convex__ */
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. */
441 "F77FLAGS", "$(FFLAGS)",
465 "YACC", "yacc", /* Or "bison -y" */
467 "MAKEINFO", "makeinfo",
469 "TEXI2DVI", "texi2dvi",
473 "CTANGLE", "ctangle",
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 $@",
515 #ifdef SCCS_GET_MINUS_G
516 "SCCS_OUTPUT_OPTION", "-G$@",
520 ".LIBPATTERNS", "%.lib",
523 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
525 ".LIBPATTERNS", "lib%.so lib%.a",
533 /* Set up the default .SUFFIXES list. */
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);
544 char *p
= default_suffixes
;
545 suffix_file
->deps
= enter_prereqs(PARSE_FILE_SEQ (&p
, struct dep
, '\0',
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
558 install_default_suffix_rules (void)
562 if (no_builtin_rules_flag
)
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. */
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;
575 f
->cmds
->recipe_prefix
= RECIPEPREFIX_DEFAULT
;
581 /* Install the default pattern rules. */
584 install_default_implicit_rules (void)
588 if (no_builtin_rules_flag
)
591 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
592 install_pattern_rule (p
, 0);
594 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
595 install_pattern_rule (p
, 1);
599 define_default_variables (void)
603 if (no_builtin_variables_flag
)
606 for (s
= default_variables
; *s
!= 0; s
+= 2)
607 define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);