1 /* Data base of default implicit rules for GNU Make.
2 Copyright (C) 1988, 89, 90, 91, 92, 93, 94 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* This is the default list of suffixes for suffix rules.
28 `.s' must come last, so that a `.o' file will be made from
29 a `.c' or `.p' or ... file rather than from a .s file. */
31 static char default_suffixes
[]
32 = ".out .a .ln .o .c .cc .C .p .f .F .r .y .l .s .S \
33 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
34 .w .ch .web .sh .elc .el";
36 static struct pspec default_pattern_rules
[] =
39 "$(AR) $(ARFLAGS) $@ $<" },
41 /* The X.out rules are only in BSD's default set because
42 BSD Make has no null-suffix rules, so `foo.out' and
43 `foo' are the same thing. */
45 "@rm -f $@ \n cp $< $@" },
47 /* Syntax is "ctangle foo.w foo.ch foo.c". */
50 { "%.tex", "%.w %.ch",
56 static struct pspec default_terminal_rules
[] =
66 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
68 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
73 static char *default_suffix_rules
[] =
76 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
78 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
80 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
82 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
84 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
86 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
88 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
90 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
92 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
94 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
96 "$(COMPILE.mod) -o $@ -e $@ $^",
99 "$(COMPILE.def) -o $@ $<",
102 "cat $< >$@ \n chmod a+x $@",
105 #if !defined(M_XENIX) || defined(__GNUC__)
106 "$(COMPILE.s) -o $@ $<",
108 "$(COMPILE.s) -o$@ $<",
109 #endif /* Not Xenix. */
111 #if !defined(M_XENIX) || defined(__GNUC__)
112 "$(COMPILE.S) -o $@ $<",
114 "$(COMPILE.S) -o$@ $<",
115 #endif /* Not Xenix. */
117 "$(COMPILE.c) $< $(OUTPUT_OPTION)",
119 "$(COMPILE.cc) $< $(OUTPUT_OPTION)",
121 "$(COMPILE.C) $< $(OUTPUT_OPTION)",
123 "$(COMPILE.f) $< $(OUTPUT_OPTION)",
125 "$(COMPILE.p) $< $(OUTPUT_OPTION)",
127 "$(COMPILE.F) $< $(OUTPUT_OPTION)",
129 "$(COMPILE.r) $< $(OUTPUT_OPTION)",
131 "$(COMPILE.mod) -o $@ $<",
136 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
138 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
141 "$(YACC.y) $< \n mv -f y.tab.c $@",
143 "@$(RM) $@ \n $(LEX.l) $< > $@",
146 "$(PREPROCESS.F) $< $(OUTPUT_OPTION)",
148 "$(PREPROCESS.r) $< $(OUTPUT_OPTION)",
150 /* This might actually make lex.yy.c if there's no %R%
151 directive in $*.l, but in that case why were you
152 trying to make $*.r anyway? */
154 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
157 "$(PREPROCESS.S) $< > $@",
160 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
163 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
166 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
172 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
175 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
178 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
181 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
187 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
195 static char *default_variables
[] =
201 /* HPUX ar's f flag says to truncate the file names to archive member
202 name length in comparisons, so replacement notices the equality. */
209 /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
210 and to the empty string if $@ does exist. */
212 "$(patsubst $@-noexist,$(CO) $(COFLAGS) $< $@,\
213 $(filter-out $@,$(firstword $(wildcard $@) $@-noexist)))",
219 "CF77PP", "/lib/cpp",
223 #else /* Not CRAY. */
231 #endif /* __convex__ */
233 /* System V uses these, so explicit rules using them should work.
234 However, there is no way to make implicit rules use them and FC. */
236 "F77FLAGS", "$(FFLAGS)",
253 "YACC", "yacc", /* Or "bison -y" */
254 "MAKEINFO", "makeinfo",
256 "TEXI2DVI", "texi2dvi",
260 "CTANGLE", "ctangle",
264 "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
265 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
266 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
267 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
268 "COMPILE.C", "$(COMPILE.cc)",
269 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
270 "LINK.C", "$(LINK.cc)",
271 "YACC.y", "$(YACC) $(YFLAGS)",
272 "LEX.l", "$(LEX) $(LFLAGS) -t",
273 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
274 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
275 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
276 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
277 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
278 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
279 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
280 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
281 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
282 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
283 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
284 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
285 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
286 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
287 #if !defined(M_XENIX) || defined(__GNUC__)
288 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
290 "PREPROCESS.S", "$(CC) -EP $(CPPFLAGS)",
291 #endif /* Not Xenix. */
292 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
293 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
294 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
296 #ifndef NO_MINUS_C_MINUS_O
297 #if !defined(M_XENIX) || defined(__GNUC__)
298 "OUTPUT_OPTION", "-o $@",
300 "OUTPUT_OPTION", "-Fo$@",
301 #endif /* Not Xenix. */
304 #ifdef SCCS_GET_MINUS_G
305 "SCCS_OUTPUT_OPTION", "-G$@",
311 /* Set up the default .SUFFIXES list. */
314 set_default_suffixes ()
316 suffix_file
= enter_file (".SUFFIXES");
318 if (no_builtin_rules_flag
)
319 (void) define_variable ("SUFFIXES", 8, "", o_default
, 0);
322 char *p
= default_suffixes
;
323 suffix_file
->deps
= (struct dep
*)
324 multi_glob (parse_file_seq (&p
, '\0', sizeof (struct dep
), 1),
325 sizeof (struct dep
));
326 (void) define_variable ("SUFFIXES", 8, default_suffixes
, o_default
, 0);
330 /* Enter the default suffix rules as file rules. This used to be done in
331 install_default_implicit_rules, but that loses because we want the
332 suffix rules installed before reading makefiles, and thee pattern rules
336 install_default_suffix_rules ()
340 if (no_builtin_rules_flag
)
343 for (s
= default_suffix_rules
; *s
!= 0; s
+= 2)
345 register struct file
*f
= enter_file (s
[0]);
346 /* Don't clobber cmds given in a makefile if there were any. */
349 f
->cmds
= (struct commands
*) xmalloc (sizeof (struct commands
));
350 f
->cmds
->filename
= 0;
351 f
->cmds
->commands
= s
[1];
352 f
->cmds
->command_lines
= 0;
358 /* Install the default pattern rules. */
361 install_default_implicit_rules ()
363 register struct pspec
*p
;
365 if (no_builtin_rules_flag
)
368 for (p
= default_pattern_rules
; p
->target
!= 0; ++p
)
369 install_pattern_rule (p
, 0);
371 for (p
= default_terminal_rules
; p
->target
!= 0; ++p
)
372 install_pattern_rule (p
, 1);
376 define_default_variables ()
380 for (s
= default_variables
; *s
!= 0; s
+= 2)
381 (void) define_variable (s
[0], strlen (s
[0]), s
[1], o_default
, 1);