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). */
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 .cc .pas .p .for .f .r .y .l .mar \
42 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
43 .w .ch .cweb .web .com .sh .elc .el";
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";
50 static struct pspec default_pattern_rules
[] =
53 "$(AR) $(ARFLAGS) $@ $<" },
55 /* The X.out rules are only in BSD's default set because
56 BSD Make has no null-suffix rules, so `foo.out' and
57 `foo' are the same thing. */
63 "@rm -f $@ \n cp $< $@" },
65 /* Syntax is "ctangle foo.w foo.ch foo.c". */
68 { "%.tex", "%.w %.ch",
74 static struct pspec default_terminal_rules
[] =
78 { "%", "%$$5lv", /* Multinet style */
79 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
80 { "%", "[.$$rcs]%$$5lv", /* Multinet style */
81 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
82 { "%", "%_v", /* Normal style */
83 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
84 { "%", "[.rcs]%_v", /* Normal style */
85 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
88 /* ain't no SCCS on vms */
100 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
102 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
107 static char *default_suffix_rules
[] =
111 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) /exe=$@",
113 "$(LINK.mar) $^ $(LOADLIBES) $(LDLIBS) /exe=$@",
115 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
117 "$(COMPILE.cc) $^ \n $(LINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
119 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
121 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
127 "$(COMPILE.mar) /obj=$@ $<",
129 "$(COMPILE.c) /obj=$@ $<",
131 "$(COMPILE.cc) /obj=$@ $<",
133 "$(COMPILE.for) /obj=$@ $<",
135 "$(COMPILE.pas) /obj=$@ $<",
138 "$(YACC.y) $< \n rename y_tab.c $@",
140 "$(LEX.l) $< \n rename lexyy.c $@",
151 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
153 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
155 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
157 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
159 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
161 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
163 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
165 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
167 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
169 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
171 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
173 "$(COMPILE.mod) -o $@ -e $@ $^",
176 "$(COMPILE.def) -o $@ $<",
179 "cat $< >$@ \n chmod a+x $@",
182 "$(COMPILE.s) -o $@ $<",
184 "$(COMPILE.S) -o $@ $<",
186 "$(COMPILE.c) $(OUTPUT_OPTION) $<",
188 "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
190 "$(COMPILE.C) $(OUTPUT_OPTION) $<",
192 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
194 "$(COMPILE.f) $(OUTPUT_OPTION) $<",
196 "$(COMPILE.p) $(OUTPUT_OPTION) $<",
198 "$(COMPILE.F) $(OUTPUT_OPTION) $<",
200 "$(COMPILE.r) $(OUTPUT_OPTION) $<",
202 "$(COMPILE.mod) -o $@ $<",
208 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
210 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
213 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
217 "$(YACC.y) $< \n mv -f y.tab.c $@",
219 "$(YACC.y) $< \n mv -f y_tab.c $@",
222 "@$(RM) $@ \n $(LEX.l) $< > $@",
225 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
227 "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
229 /* This might actually make lex.yy.c if there's no %R%
230 directive in $*.l, but in that case why were you
231 trying to make $*.r anyway? */
233 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
236 "$(PREPROCESS.S) $< > $@",
239 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
242 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
245 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
251 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
254 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
257 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
260 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
266 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
276 static char *default_variables
[] =
280 "ARFLAGS", "/replace",
286 "CPP", "$(CC) /preprocess_only",
288 /* System V uses these, so explicit rules using them should work.
289 However, there is no way to make implicit rules use them and FC. */
291 "F77FLAGS", "$(FFLAGS)",
295 "YACC", "yacc", /* Or "bison -y" */
296 "MAKEINFO", "makeinfo",
298 "TEXINDEX", "texindex",
300 "RM", "delete/nolog",
302 "LINK.obj", "$(LD) $(LDFLAGS)",
303 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
304 "COMPILE.cc", "$(C++) $(C++FLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
305 "YACC.y", "$(YACC) $(YFLAGS)",
306 "LEX.l", "$(LEX) $(LFLAGS)",
307 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
308 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
309 "COMPILE.mar", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
310 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
312 "MV", "rename/new_version",
328 /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
329 and to the empty string if $@ does exist. */
331 "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
337 "CF77PP", "/lib/cpp",
341 #else /* Not CRAY. */
349 #endif /* __convex__ */
351 /* System V uses these, so explicit rules using them should work.
352 However, there is no way to make implicit rules use them and FC. */
354 "F77FLAGS", "$(FFLAGS)",
378 "YACC", "yacc", /* Or "bison -y" */
380 "MAKEINFO", "makeinfo",
382 "TEXI2DVI", "texi2dvi",
386 "CTANGLE", "ctangle",
390 "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
391 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
392 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
393 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
394 "COMPILE.C", "$(COMPILE.cc)",
395 "COMPILE.cpp", "$(COMPILE.cc)",
396 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
397 "LINK.C", "$(LINK.cc)",
398 "LINK.cpp", "$(LINK.cc)",
399 "YACC.y", "$(YACC) $(YFLAGS)",
400 "LEX.l", "$(LEX) $(LFLAGS) -t",
401 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
402 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
403 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
404 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
405 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
406 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
407 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
408 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
409 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
410 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
411 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
412 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
413 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
414 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
415 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
416 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
417 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
418 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
420 #ifndef NO_MINUS_C_MINUS_O
421 "OUTPUT_OPTION", "-o $@",
424 #ifdef SCCS_GET_MINUS_G
425 "SCCS_OUTPUT_OPTION", "-G$@",
429 ".LIBPATTERNS", "%.lib",
432 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
434 ".LIBPATTERNS", "lib%.so lib%.a",
442 /* Set up the default .SUFFIXES list. */
445 set_default_suffixes ()
447 suffix_file
= enter_file (".SUFFIXES");
449 if (no_builtin_rules_flag
)
450 (void) define_variable ("SUFFIXES", 8, "", o_default
, 0);
453 char *p
= default_suffixes
;
454 suffix_file
->deps
= (struct dep
*)
455 multi_glob (parse_file_seq (&p
, '\0', sizeof (struct dep
), 1),
456 sizeof (struct dep
));
457 (void) define_variable ("SUFFIXES", 8, default_suffixes
, o_default
, 0);
461 /* Enter the default suffix rules as file rules. This used to be done in
462 install_default_implicit_rules, but that loses because we want the
463 suffix rules installed before reading makefiles, and thee pattern rules
467 install_default_suffix_rules ()
471 if (no_builtin_rules_flag
)
474 for (s
= default_suffix_rules
; *s
!= 0; s
+= 2)
476 register struct file
*f
= enter_file (s
[0]);
477 /* Don't clobber cmds given in a makefile if there were any. */
480 f
->cmds
= (struct commands
*) xmalloc (sizeof (struct commands
));
481 f
->cmds
->fileinfo
.filenm
= 0;
482 f
->cmds
->commands
= s
[1];
483 f
->cmds
->command_lines
= 0;
489 /* Install the default pattern rules. */
492 install_default_implicit_rules ()
494 register struct pspec
*p
;
496 if (no_builtin_rules_flag
)
499 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
500 install_pattern_rule (p
, 0);
502 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
503 install_pattern_rule (p
, 1);
507 define_default_variables ()
511 if (no_builtin_variables_flag
)
514 for (s
= default_variables
; *s
!= 0; s
+= 2)
515 (void) define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);