1 /* Data base of default implicit rules for GNU Make.
2 Copyright (C) 1988,89,90,91,92,93,94,95,96 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
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
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
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. */
39 static char 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 .r .y .l .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 .r .y .l .s .S \
50 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
51 .w .ch .web .sh .elc .el";
54 static struct pspec default_pattern_rules
[] =
57 "$(AR) $(ARFLAGS) $@ $<" },
59 /* The X.out rules are only in BSD's default set because
60 BSD Make has no null-suffix rules, so `foo.out' and
61 `foo' are the same thing. */
67 "@rm -f $@ \n cp $< $@" },
69 /* Syntax is "ctangle foo.w foo.ch foo.c". */
72 { "%.tex", "%.w %.ch",
78 static struct pspec default_terminal_rules
[] =
82 { "%", "%$$5lv", /* Multinet style */
83 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
84 { "%", "[.$$rcs]%$$5lv", /* Multinet style */
85 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
86 { "%", "%_v", /* Normal style */
87 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
88 { "%", "[.rcs]%_v", /* Normal style */
89 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
92 /* ain't no SCCS on vms */
104 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
106 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
111 static char *default_suffix_rules
[] =
115 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
117 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
119 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
121 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
124 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
126 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
128 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
131 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
133 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
139 "$(COMPILE.mar) /obj=$@ $<",
141 "$(COMPILE.s) /obj=$@ $<",
143 "$(COMPILE.s) /obj=$@ $<",
145 "$(COMPILE.c)/prep /list=$@ $<",
147 "$(COMPILE.c)/noobj/machine /list=$@ $<",
149 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
151 "$(COMPILE.c) /obj=$@ $<",
153 "$(COMPILE.cc)/prep /list=$@ $<",
155 "$(COMPILE.cc)/noobj/machine /list=$@ $<",
157 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
159 "$(COMPILE.cc) /obj=$@ $<",
161 "$(COMPILE.cxx) /obj=$@ $<",
163 "$(COMPILE.for) /obj=$@ $<",
165 "$(COMPILE.pas) /obj=$@ $<",
168 "$(YACC.y) $< \n rename y_tab.c $@",
170 "$(LEX.l) $< \n rename lexyy.c $@",
181 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
183 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
185 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
187 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
189 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
191 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
193 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
195 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
197 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
199 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
201 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
203 "$(COMPILE.mod) -o $@ -e $@ $^",
206 "$(COMPILE.def) -o $@ $<",
209 "cat $< >$@ \n chmod a+x $@",
212 "$(COMPILE.s) -o $@ $<",
214 "$(COMPILE.S) -o $@ $<",
216 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
218 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
220 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
222 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
224 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
226 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
228 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
230 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
232 "$(COMPILE.mod) -o $@ $<",
238 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
240 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
243 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
247 "$(YACC.y) $< \n mv -f y.tab.c $@",
249 "$(YACC.y) $< \n mv -f y_tab.c $@",
252 "@$(RM) $@ \n $(LEX.l) $< > $@",
255 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
257 "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
259 /* This might actually make lex.yy.c if there's no %R%
260 directive in $*.l, but in that case why were you
261 trying to make $*.r anyway? */
263 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
266 "$(PREPROCESS.S) $< > $@",
269 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
272 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
275 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
281 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
284 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
287 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
290 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
296 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
306 static char *default_variables
[] =
319 "ARFLAGS", "/replace",
329 "ECHO", "write sys$$output \"",
339 "CPP", "$(CC) /preprocess_only",
341 /* System V uses these, so explicit rules using them should work.
342 However, there is no way to make implicit rules use them and FC. */
344 "F77FLAGS", "$(FFLAGS)",
348 "YACC", "bison/yacc",
349 "YFLAGS", "/Define/Verbose",
351 "MAKEINFO", "makeinfo",
353 "TEXINDEX", "texindex",
355 "RM", "delete/nolog",
359 "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
360 "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
361 "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
362 "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
363 "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
372 "LINK.obj", "$(LD) $(LDFLAGS)",
373 #ifndef GCC_IS_NATIVE
374 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
375 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
377 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
378 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
379 "YACC.y", "$(YACC) $(YFLAGS)",
380 "LEX.l", "$(LEX) $(LFLAGS)",
381 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
382 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
383 "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
384 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
385 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
387 "MV", "rename/new_version",
398 "CXX", "gpp", /* g++ is an invalid name on MSDOS */
401 # endif /* __MSDOS__ */
407 /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
408 and to the empty string if $@ does exist. */
409 "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
416 "CF77PP", "/lib/cpp",
420 #else /* Not CRAY. */
428 #endif /* __convex__ */
430 /* System V uses these, so explicit rules using them should work.
431 However, there is no way to make implicit rules use them and FC. */
433 "F77FLAGS", "$(FFLAGS)",
457 "YACC", "yacc", /* Or "bison -y" */
459 "MAKEINFO", "makeinfo",
461 "TEXI2DVI", "texi2dvi",
465 "CTANGLE", "ctangle",
469 "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
470 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
471 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
472 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
473 "COMPILE.C", "$(COMPILE.cc)",
474 "COMPILE.cpp", "$(COMPILE.cc)",
475 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
476 "LINK.C", "$(LINK.cc)",
477 "LINK.cpp", "$(LINK.cc)",
478 "YACC.y", "$(YACC) $(YFLAGS)",
479 "LEX.l", "$(LEX) $(LFLAGS) -t",
480 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
481 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
482 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
483 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
484 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
485 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
486 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
487 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
488 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
489 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
490 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
491 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
492 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
493 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
494 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
495 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
496 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
497 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
499 #ifndef NO_MINUS_C_MINUS_O
500 "OUTPUT_OPTION", "-o $@",
503 #ifdef SCCS_GET_MINUS_G
504 "SCCS_OUTPUT_OPTION", "-G$@",
508 ".LIBPATTERNS", "%.lib",
511 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
513 ".LIBPATTERNS", "lib%.so lib%.a",
521 /* Set up the default .SUFFIXES list. */
524 set_default_suffixes (void)
526 suffix_file
= enter_file (".SUFFIXES");
528 if (no_builtin_rules_flag
)
529 (void) define_variable ("SUFFIXES", 8, "", o_default
, 0);
532 char *p
= default_suffixes
;
533 suffix_file
->deps
= (struct dep
*)
534 multi_glob (parse_file_seq (&p
, '\0', sizeof (struct dep
), 1),
535 sizeof (struct dep
));
536 (void) define_variable ("SUFFIXES", 8, default_suffixes
, o_default
, 0);
540 /* Enter the default suffix rules as file rules. This used to be done in
541 install_default_implicit_rules, but that loses because we want the
542 suffix rules installed before reading makefiles, and thee pattern rules
546 install_default_suffix_rules (void)
550 if (no_builtin_rules_flag
)
553 for (s
= default_suffix_rules
; *s
!= 0; s
+= 2)
555 register struct file
*f
= enter_file (s
[0]);
556 /* Don't clobber cmds given in a makefile if there were any. */
559 f
->cmds
= (struct commands
*) xmalloc (sizeof (struct commands
));
560 f
->cmds
->fileinfo
.filenm
= 0;
561 f
->cmds
->commands
= s
[1];
562 f
->cmds
->command_lines
= 0;
568 /* Install the default pattern rules. */
571 install_default_implicit_rules (void)
573 register struct pspec
*p
;
575 if (no_builtin_rules_flag
)
578 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
579 install_pattern_rule (p
, 0);
581 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
582 install_pattern_rule (p
, 1);
586 define_default_variables (void)
590 if (no_builtin_variables_flag
)
593 for (s
= default_variables
; *s
!= 0; s
+= 2)
594 (void) define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);