1 /* Data base of default implicit rules for GNU Make.
2 Copyright (C) 1988-2012 Free Software Foundation, Inc.
3 This file is part of GNU Make.
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
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.
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/>. */
25 /* Define GCC_IS_NATIVE if gcc is the native development environment on
26 your system (gcc/bison/flex vs cc/yacc/lex). */
27 #if defined(__MSDOS__) || defined(__EMX__)
28 # define GCC_IS_NATIVE
32 /* This is the default list of suffixes for suffix rules.
33 '.s' must come last, so that a '.o' file will be made from
34 a '.c' or '.p' or ... file rather than from a .s file. */
36 static char default_suffixes
[]
38 = ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
39 .s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
40 .w .ch .cweb .web .com .sh .elc .el";
41 #elif defined(__EMX__)
42 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
43 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
44 .w .ch .web .sh .elc .el .obj .exe .dll .lib";
46 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
47 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
48 .w .ch .web .sh .elc .el";
51 static struct pspec default_pattern_rules
[] =
54 "$(AR) $(ARFLAGS) $@ $<" },
56 /* The X.out rules are only in BSD's default set because
57 BSD Make has no null-suffix rules, so 'foo.out' and
58 'foo' are the same thing. */
64 "@rm -f $@ \n cp $< $@" },
66 /* Syntax is "ctangle foo.w foo.ch foo.c". */
69 { "%.tex", "%.w %.ch",
75 static struct pspec default_terminal_rules
[] =
79 { "%", "%$$5lv", /* Multinet style */
80 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
81 { "%", "[.$$rcs]%$$5lv", /* Multinet style */
82 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
83 { "%", "%_v", /* Normal style */
84 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
85 { "%", "[.rcs]%_v", /* Normal style */
86 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
89 /* ain't no SCCS on vms */
101 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
103 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
108 static char *default_suffix_rules
[] =
112 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
114 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
116 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
118 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
121 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
123 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
125 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
128 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
130 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
136 "$(COMPILE.mar) /obj=$@ $<",
138 "$(COMPILE.s) /obj=$@ $<",
140 "$(COMPILE.s) /obj=$@ $<",
142 "$(COMPILE.c)/prep /list=$@ $<",
144 "$(COMPILE.c)/noobj/machine /list=$@ $<",
146 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
148 "$(COMPILE.c) /obj=$@ $<",
150 "$(COMPILE.cc)/prep /list=$@ $<",
152 "$(COMPILE.cc)/noobj/machine /list=$@ $<",
154 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
156 "$(COMPILE.cc) /obj=$@ $<",
158 "$(COMPILE.cxx) /obj=$@ $<",
160 "$(COMPILE.for) /obj=$@ $<",
162 "$(COMPILE.pas) /obj=$@ $<",
165 "$(YACC.y) $< \n rename y_tab.c $@",
167 "$(LEX.l) $< \n rename lexyy.c $@",
178 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
180 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
182 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
184 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
186 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
188 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
190 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
192 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
194 "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@",
196 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
198 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
200 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
202 "$(COMPILE.mod) -o $@ -e $@ $^",
205 "$(COMPILE.def) -o $@ $<",
208 "cat $< >$@ \n chmod a+x $@",
211 "$(COMPILE.s) -o $@ $<",
213 "$(COMPILE.S) -o $@ $<",
215 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
217 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
219 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
221 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
223 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
225 "$(COMPILE.m) $(OUTPUT_OPTION) $<",
227 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
229 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
231 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
233 "$(COMPILE.mod) -o $@ $<",
239 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
241 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
244 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
248 "$(YACC.y) $< \n mv -f y.tab.c $@",
250 "$(YACC.y) $< \n mv -f y_tab.c $@",
253 "@$(RM) $@ \n $(LEX.l) $< > $@",
255 "$(YACC.m) $< \n mv -f y.tab.c $@",
257 "@$(RM) $@ \n $(LEX.m) $< > $@",
260 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
262 "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
264 /* This might actually make lex.yy.c if there's no %R% directive in $*.l,
265 but in that case why were you trying to make $*.r anyway? */
267 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
270 "$(PREPROCESS.S) $< > $@",
273 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
276 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
279 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
285 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
288 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
291 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
294 "$(CTANGLE) $< - $@", /* The '-' says there is no '.ch' file. */
300 "$(CWEAVE) $< - $@", /* The '-' says there is no '.ch' file. */
310 static const char *default_variables
[] =
323 "ARFLAGS", "/replace",
333 "ECHO", "write sys$$output \"",
343 "CPP", "$(CC) /preprocess_only",
345 /* System V uses these, so explicit rules using them should work.
346 However, there is no way to make implicit rules use them and FC. */
348 "F77FLAGS", "$(FFLAGS)",
352 "YACC", "bison/yacc",
353 "YFLAGS", "/Define/Verbose",
355 "MAKEINFO", "makeinfo",
357 "TEXINDEX", "texindex",
359 "RM", "delete/nolog",
363 "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
364 "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
365 "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
366 "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
367 "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
376 "LINK.obj", "$(LD) $(LDFLAGS)",
377 #ifndef GCC_IS_NATIVE
378 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
379 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
381 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
382 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
383 "YACC.y", "$(YACC) $(YFLAGS)",
384 "LEX.l", "$(LEX) $(LFLAGS)",
385 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
386 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
387 "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
388 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
389 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
391 "MV", "rename/new_version",
402 "CXX", "gpp", /* g++ is an invalid name on MSDOS */
405 # endif /* __MSDOS__ */
413 /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
414 and to the empty string if $@ does exist. */
415 "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
422 "CF77PP", "/lib/cpp",
426 #else /* Not CRAY. */
434 #endif /* __convex__ */
436 /* System V uses these, so explicit rules using them should work.
437 However, there is no way to make implicit rules use them and FC. */
439 "F77FLAGS", "$(FFLAGS)",
463 "YACC", "yacc", /* Or "bison -y" */
465 "MAKEINFO", "makeinfo",
467 "TEXI2DVI", "texi2dvi",
471 "CTANGLE", "ctangle",
475 "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
476 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
477 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
478 "COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
479 "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
480 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
481 "COMPILE.C", "$(COMPILE.cc)",
482 "COMPILE.cpp", "$(COMPILE.cc)",
483 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
484 "LINK.C", "$(LINK.cc)",
485 "LINK.cpp", "$(LINK.cc)",
486 "YACC.y", "$(YACC) $(YFLAGS)",
487 "LEX.l", "$(LEX) $(LFLAGS) -t",
488 "YACC.m", "$(YACC) $(YFLAGS)",
489 "LEX.m", "$(LEX) $(LFLAGS) -t",
490 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
491 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
492 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
493 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
494 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
495 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
496 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
497 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
498 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
499 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
500 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
501 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
502 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
503 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
504 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
505 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
506 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
507 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
509 #ifndef NO_MINUS_C_MINUS_O
510 "OUTPUT_OPTION", "-o $@",
513 #ifdef SCCS_GET_MINUS_G
514 "SCCS_OUTPUT_OPTION", "-G$@",
518 ".LIBPATTERNS", "%.lib",
519 #elif defined(__MSDOS__)
520 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
521 #elif defined(__APPLE__)
522 ".LIBPATTERNS", "lib%.dylib lib%.a",
524 ".LIBPATTERNS", "lib%.so lib%.a",
531 /* Set up the default .SUFFIXES list. */
534 set_default_suffixes (void)
536 suffix_file
= enter_file (strcache_add (".SUFFIXES"));
538 if (no_builtin_rules_flag
)
539 define_variable_cname ("SUFFIXES", "", o_default
, 0);
542 char *p
= default_suffixes
;
543 suffix_file
->deps
= enter_prereqs(PARSE_FILE_SEQ (&p
, struct dep
, '\0',
546 define_variable_cname ("SUFFIXES", default_suffixes
, o_default
, 0);
550 /* Enter the default suffix rules as file rules. This used to be done in
551 install_default_implicit_rules, but that loses because we want the
552 suffix rules installed before reading makefiles, and the pattern rules
556 install_default_suffix_rules (void)
560 if (no_builtin_rules_flag
)
563 for (s
= default_suffix_rules
; *s
!= 0; s
+= 2)
565 struct file
*f
= enter_file (strcache_add (s
[0]));
566 /* Don't clobber cmds given in a makefile if there were any. */
569 f
->cmds
= xmalloc (sizeof (struct commands
));
570 f
->cmds
->fileinfo
.filenm
= 0;
571 f
->cmds
->commands
= s
[1];
572 f
->cmds
->command_lines
= 0;
573 f
->cmds
->recipe_prefix
= RECIPEPREFIX_DEFAULT
;
579 /* Install the default pattern rules. */
582 install_default_implicit_rules (void)
586 if (no_builtin_rules_flag
)
589 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
590 install_pattern_rule (p
, 0);
592 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
593 install_pattern_rule (p
, 1);
597 define_default_variables (void)
601 if (no_builtin_variables_flag
)
604 for (s
= default_variables
; *s
!= 0; s
+= 2)
605 define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);