xref: /netbsd-src/external/gpl2/gmake/dist/default.c (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos /* Data base of default implicit rules for GNU Make.
2*69606e3fSchristos Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3*69606e3fSchristos 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
4*69606e3fSchristos Foundation, Inc.
5*69606e3fSchristos This file is part of GNU Make.
6*69606e3fSchristos 
7*69606e3fSchristos GNU Make is free software; you can redistribute it and/or modify it under the
8*69606e3fSchristos terms of the GNU General Public License as published by the Free Software
9*69606e3fSchristos Foundation; either version 2, or (at your option) any later version.
10*69606e3fSchristos 
11*69606e3fSchristos GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
12*69606e3fSchristos WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13*69606e3fSchristos A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14*69606e3fSchristos 
15*69606e3fSchristos You should have received a copy of the GNU General Public License along with
16*69606e3fSchristos GNU Make; see the file COPYING.  If not, write to the Free Software
17*69606e3fSchristos Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
18*69606e3fSchristos 
19*69606e3fSchristos #include "make.h"
20*69606e3fSchristos #include "filedef.h"
21*69606e3fSchristos #include "variable.h"
22*69606e3fSchristos #include "rule.h"
23*69606e3fSchristos #include "dep.h"
24*69606e3fSchristos #include "job.h"
25*69606e3fSchristos #include "commands.h"
26*69606e3fSchristos 
27*69606e3fSchristos /* Define GCC_IS_NATIVE if gcc is the native development environment on
28*69606e3fSchristos    your system (gcc/bison/flex vs cc/yacc/lex).  */
29*69606e3fSchristos #if defined(__MSDOS__) || defined(__EMX__)
30*69606e3fSchristos # define GCC_IS_NATIVE
31*69606e3fSchristos #endif
32*69606e3fSchristos 
33*69606e3fSchristos 
34*69606e3fSchristos /* This is the default list of suffixes for suffix rules.
35*69606e3fSchristos    `.s' must come last, so that a `.o' file will be made from
36*69606e3fSchristos    a `.c' or `.p' or ... file rather than from a .s file.  */
37*69606e3fSchristos 
38*69606e3fSchristos static char default_suffixes[]
39*69606e3fSchristos #ifdef VMS
40*69606e3fSchristos   = ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
41*69606e3fSchristos .s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
42*69606e3fSchristos .w .ch .cweb .web .com .sh .elc .el";
43*69606e3fSchristos #elif defined(__EMX__)
44*69606e3fSchristos   = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
45*69606e3fSchristos .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
46*69606e3fSchristos .w .ch .web .sh .elc .el .obj .exe .dll .lib";
47*69606e3fSchristos #else
48*69606e3fSchristos   = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
49*69606e3fSchristos .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
50*69606e3fSchristos .w .ch .web .sh .elc .el";
51*69606e3fSchristos #endif
52*69606e3fSchristos 
53*69606e3fSchristos static struct pspec default_pattern_rules[] =
54*69606e3fSchristos   {
55*69606e3fSchristos     { "(%)", "%",
56*69606e3fSchristos 	"$(AR) $(ARFLAGS) $@ $<" },
57*69606e3fSchristos 
58*69606e3fSchristos     /* The X.out rules are only in BSD's default set because
59*69606e3fSchristos        BSD Make has no null-suffix rules, so `foo.out' and
60*69606e3fSchristos        `foo' are the same thing.  */
61*69606e3fSchristos #ifdef VMS
62*69606e3fSchristos     { "%.exe", "%",
63*69606e3fSchristos         "copy $< $@" },
64*69606e3fSchristos #else
65*69606e3fSchristos     { "%.out", "%",
66*69606e3fSchristos 	"@rm -f $@ \n cp $< $@" },
67*69606e3fSchristos #endif
68*69606e3fSchristos     /* Syntax is "ctangle foo.w foo.ch foo.c".  */
69*69606e3fSchristos     { "%.c", "%.w %.ch",
70*69606e3fSchristos 	"$(CTANGLE) $^ $@" },
71*69606e3fSchristos     { "%.tex", "%.w %.ch",
72*69606e3fSchristos 	"$(CWEAVE) $^ $@" },
73*69606e3fSchristos 
74*69606e3fSchristos     { 0, 0, 0 }
75*69606e3fSchristos   };
76*69606e3fSchristos 
77*69606e3fSchristos static struct pspec default_terminal_rules[] =
78*69606e3fSchristos   {
79*69606e3fSchristos #ifdef VMS
80*69606e3fSchristos     /* RCS.  */
81*69606e3fSchristos     { "%", "%$$5lv", /* Multinet style */
82*69606e3fSchristos         "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
83*69606e3fSchristos     { "%", "[.$$rcs]%$$5lv", /* Multinet style */
84*69606e3fSchristos         "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
85*69606e3fSchristos     { "%", "%_v", /* Normal style */
86*69606e3fSchristos         "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
87*69606e3fSchristos     { "%", "[.rcs]%_v", /* Normal style */
88*69606e3fSchristos         "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
89*69606e3fSchristos 
90*69606e3fSchristos     /* SCCS.  */
91*69606e3fSchristos 	/* ain't no SCCS on vms */
92*69606e3fSchristos #else
93*69606e3fSchristos     /* RCS.  */
94*69606e3fSchristos     { "%", "%,v",
95*69606e3fSchristos 	"$(CHECKOUT,v)" },
96*69606e3fSchristos     { "%", "RCS/%,v",
97*69606e3fSchristos 	"$(CHECKOUT,v)" },
98*69606e3fSchristos     { "%", "RCS/%",
99*69606e3fSchristos 	"$(CHECKOUT,v)" },
100*69606e3fSchristos 
101*69606e3fSchristos     /* SCCS.  */
102*69606e3fSchristos     { "%", "s.%",
103*69606e3fSchristos 	"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
104*69606e3fSchristos     { "%", "SCCS/s.%",
105*69606e3fSchristos 	"$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
106*69606e3fSchristos #endif /* !VMS */
107*69606e3fSchristos     { 0, 0, 0 }
108*69606e3fSchristos   };
109*69606e3fSchristos 
110*69606e3fSchristos static char *default_suffix_rules[] =
111*69606e3fSchristos   {
112*69606e3fSchristos #ifdef VMS
113*69606e3fSchristos     ".obj.exe",
114*69606e3fSchristos     "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
115*69606e3fSchristos     ".mar.exe",
116*69606e3fSchristos     "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
117*69606e3fSchristos     ".s.exe",
118*69606e3fSchristos     "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
119*69606e3fSchristos     ".c.exe",
120*69606e3fSchristos     "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
121*69606e3fSchristos     ".cc.exe",
122*69606e3fSchristos #ifdef GCC_IS_NATIVE
123*69606e3fSchristos     "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
124*69606e3fSchristos #else
125*69606e3fSchristos     "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
126*69606e3fSchristos     ".cxx.exe",
127*69606e3fSchristos     "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
128*69606e3fSchristos #endif
129*69606e3fSchristos     ".for.exe",
130*69606e3fSchristos     "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
131*69606e3fSchristos     ".pas.exe",
132*69606e3fSchristos     "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
133*69606e3fSchristos 
134*69606e3fSchristos     ".com",
135*69606e3fSchristos     "copy $< >$@",
136*69606e3fSchristos 
137*69606e3fSchristos     ".mar.obj",
138*69606e3fSchristos     "$(COMPILE.mar) /obj=$@ $<",
139*69606e3fSchristos     ".s.obj",
140*69606e3fSchristos     "$(COMPILE.s) /obj=$@ $<",
141*69606e3fSchristos     ".ss.obj",
142*69606e3fSchristos     "$(COMPILE.s) /obj=$@ $<",
143*69606e3fSchristos     ".c.i",
144*69606e3fSchristos     "$(COMPILE.c)/prep /list=$@ $<",
145*69606e3fSchristos     ".c.s",
146*69606e3fSchristos     "$(COMPILE.c)/noobj/machine /list=$@ $<",
147*69606e3fSchristos     ".i.s",
148*69606e3fSchristos     "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
149*69606e3fSchristos     ".c.obj",
150*69606e3fSchristos     "$(COMPILE.c) /obj=$@ $<",
151*69606e3fSchristos     ".cc.ii",
152*69606e3fSchristos     "$(COMPILE.cc)/prep /list=$@ $<",
153*69606e3fSchristos     ".cc.ss",
154*69606e3fSchristos     "$(COMPILE.cc)/noobj/machine /list=$@ $<",
155*69606e3fSchristos     ".ii.ss",
156*69606e3fSchristos     "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
157*69606e3fSchristos     ".cc.obj",
158*69606e3fSchristos     "$(COMPILE.cc) /obj=$@ $<",
159*69606e3fSchristos     ".cxx.obj",
160*69606e3fSchristos     "$(COMPILE.cxx) /obj=$@ $<",
161*69606e3fSchristos     ".for.obj",
162*69606e3fSchristos     "$(COMPILE.for) /obj=$@ $<",
163*69606e3fSchristos     ".pas.obj",
164*69606e3fSchristos     "$(COMPILE.pas) /obj=$@ $<",
165*69606e3fSchristos 
166*69606e3fSchristos     ".y.c",
167*69606e3fSchristos     "$(YACC.y) $< \n rename y_tab.c $@",
168*69606e3fSchristos     ".l.c",
169*69606e3fSchristos     "$(LEX.l) $< \n rename lexyy.c $@",
170*69606e3fSchristos 
171*69606e3fSchristos     ".texinfo.info",
172*69606e3fSchristos     "$(MAKEINFO) $<",
173*69606e3fSchristos 
174*69606e3fSchristos     ".tex.dvi",
175*69606e3fSchristos     "$(TEX) $<",
176*69606e3fSchristos 
177*69606e3fSchristos #else /* ! VMS */
178*69606e3fSchristos 
179*69606e3fSchristos     ".o",
180*69606e3fSchristos     "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
181*69606e3fSchristos     ".s",
182*69606e3fSchristos     "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
183*69606e3fSchristos     ".S",
184*69606e3fSchristos     "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
185*69606e3fSchristos     ".c",
186*69606e3fSchristos     "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
187*69606e3fSchristos     ".cc",
188*69606e3fSchristos     "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
189*69606e3fSchristos     ".C",
190*69606e3fSchristos     "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
191*69606e3fSchristos     ".cpp",
192*69606e3fSchristos     "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
193*69606e3fSchristos     ".f",
194*69606e3fSchristos     "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
195*69606e3fSchristos     ".p",
196*69606e3fSchristos     "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
197*69606e3fSchristos     ".F",
198*69606e3fSchristos     "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
199*69606e3fSchristos     ".r",
200*69606e3fSchristos     "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
201*69606e3fSchristos     ".mod",
202*69606e3fSchristos     "$(COMPILE.mod) -o $@ -e $@ $^",
203*69606e3fSchristos 
204*69606e3fSchristos     ".def.sym",
205*69606e3fSchristos     "$(COMPILE.def) -o $@ $<",
206*69606e3fSchristos 
207*69606e3fSchristos     ".sh",
208*69606e3fSchristos     "cat $< >$@ \n chmod a+x $@",
209*69606e3fSchristos 
210*69606e3fSchristos     ".s.o",
211*69606e3fSchristos     "$(COMPILE.s) -o $@ $<",
212*69606e3fSchristos     ".S.o",
213*69606e3fSchristos     "$(COMPILE.S) -o $@ $<",
214*69606e3fSchristos     ".c.o",
215*69606e3fSchristos     "$(COMPILE.c) $(OUTPUT_OPTION) $<",
216*69606e3fSchristos     ".cc.o",
217*69606e3fSchristos     "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
218*69606e3fSchristos     ".C.o",
219*69606e3fSchristos     "$(COMPILE.C) $(OUTPUT_OPTION) $<",
220*69606e3fSchristos     ".cpp.o",
221*69606e3fSchristos     "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
222*69606e3fSchristos     ".f.o",
223*69606e3fSchristos     "$(COMPILE.f) $(OUTPUT_OPTION) $<",
224*69606e3fSchristos     ".p.o",
225*69606e3fSchristos     "$(COMPILE.p) $(OUTPUT_OPTION) $<",
226*69606e3fSchristos     ".F.o",
227*69606e3fSchristos     "$(COMPILE.F) $(OUTPUT_OPTION) $<",
228*69606e3fSchristos     ".r.o",
229*69606e3fSchristos     "$(COMPILE.r) $(OUTPUT_OPTION) $<",
230*69606e3fSchristos     ".mod.o",
231*69606e3fSchristos     "$(COMPILE.mod) -o $@ $<",
232*69606e3fSchristos 
233*69606e3fSchristos     ".c.ln",
234*69606e3fSchristos     "$(LINT.c) -C$* $<",
235*69606e3fSchristos     ".y.ln",
236*69606e3fSchristos #ifndef __MSDOS__
237*69606e3fSchristos     "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
238*69606e3fSchristos #else
239*69606e3fSchristos     "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
240*69606e3fSchristos #endif
241*69606e3fSchristos     ".l.ln",
242*69606e3fSchristos     "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
243*69606e3fSchristos 
244*69606e3fSchristos     ".y.c",
245*69606e3fSchristos #ifndef __MSDOS__
246*69606e3fSchristos     "$(YACC.y) $< \n mv -f y.tab.c $@",
247*69606e3fSchristos #else
248*69606e3fSchristos     "$(YACC.y) $< \n mv -f y_tab.c $@",
249*69606e3fSchristos #endif
250*69606e3fSchristos     ".l.c",
251*69606e3fSchristos     "@$(RM) $@ \n $(LEX.l) $< > $@",
252*69606e3fSchristos 
253*69606e3fSchristos     ".F.f",
254*69606e3fSchristos     "$(PREPROCESS.F) $(OUTPUT_OPTION) $<",
255*69606e3fSchristos     ".r.f",
256*69606e3fSchristos     "$(PREPROCESS.r) $(OUTPUT_OPTION) $<",
257*69606e3fSchristos 
258*69606e3fSchristos     /* This might actually make lex.yy.c if there's no %R%
259*69606e3fSchristos        directive in $*.l, but in that case why were you
260*69606e3fSchristos        trying to make $*.r anyway?  */
261*69606e3fSchristos     ".l.r",
262*69606e3fSchristos     "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
263*69606e3fSchristos 
264*69606e3fSchristos     ".S.s",
265*69606e3fSchristos     "$(PREPROCESS.S) $< > $@",
266*69606e3fSchristos 
267*69606e3fSchristos     ".texinfo.info",
268*69606e3fSchristos     "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
269*69606e3fSchristos 
270*69606e3fSchristos     ".texi.info",
271*69606e3fSchristos     "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
272*69606e3fSchristos 
273*69606e3fSchristos     ".txinfo.info",
274*69606e3fSchristos     "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",
275*69606e3fSchristos 
276*69606e3fSchristos     ".tex.dvi",
277*69606e3fSchristos     "$(TEX) $<",
278*69606e3fSchristos 
279*69606e3fSchristos     ".texinfo.dvi",
280*69606e3fSchristos     "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
281*69606e3fSchristos 
282*69606e3fSchristos     ".texi.dvi",
283*69606e3fSchristos     "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
284*69606e3fSchristos 
285*69606e3fSchristos     ".txinfo.dvi",
286*69606e3fSchristos     "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
287*69606e3fSchristos 
288*69606e3fSchristos     ".w.c",
289*69606e3fSchristos     "$(CTANGLE) $< - $@",	/* The `-' says there is no `.ch' file.  */
290*69606e3fSchristos 
291*69606e3fSchristos     ".web.p",
292*69606e3fSchristos     "$(TANGLE) $<",
293*69606e3fSchristos 
294*69606e3fSchristos     ".w.tex",
295*69606e3fSchristos     "$(CWEAVE) $< - $@",	/* The `-' says there is no `.ch' file.  */
296*69606e3fSchristos 
297*69606e3fSchristos     ".web.tex",
298*69606e3fSchristos     "$(WEAVE) $<",
299*69606e3fSchristos 
300*69606e3fSchristos #endif /* !VMS */
301*69606e3fSchristos 
302*69606e3fSchristos     0, 0,
303*69606e3fSchristos   };
304*69606e3fSchristos 
305*69606e3fSchristos static char *default_variables[] =
306*69606e3fSchristos   {
307*69606e3fSchristos #ifdef VMS
308*69606e3fSchristos #ifdef __ALPHA
309*69606e3fSchristos     "ARCH", "ALPHA",
310*69606e3fSchristos #endif
311*69606e3fSchristos #ifdef __ia64
312*69606e3fSchristos     "ARCH", "IA64",
313*69606e3fSchristos #endif
314*69606e3fSchristos #ifdef __VAX
315*69606e3fSchristos     "ARCH", "VAX",
316*69606e3fSchristos #endif
317*69606e3fSchristos     "AR", "library/obj",
318*69606e3fSchristos     "ARFLAGS", "/replace",
319*69606e3fSchristos     "AS", "macro",
320*69606e3fSchristos     "MACRO", "macro",
321*69606e3fSchristos #ifdef GCC_IS_NATIVE
322*69606e3fSchristos     "CC", "gcc",
323*69606e3fSchristos #else
324*69606e3fSchristos     "CC", "cc",
325*69606e3fSchristos #endif
326*69606e3fSchristos     "CD", "builtin_cd",
327*69606e3fSchristos     "MAKE", "make",
328*69606e3fSchristos     "ECHO", "write sys$$output \"",
329*69606e3fSchristos #ifdef GCC_IS_NATIVE
330*69606e3fSchristos     "C++", "gcc/plus",
331*69606e3fSchristos     "CXX", "gcc/plus",
332*69606e3fSchristos #else
333*69606e3fSchristos     "C++", "cxx",
334*69606e3fSchristos     "CXX", "cxx",
335*69606e3fSchristos     "CXXLD", "cxxlink",
336*69606e3fSchristos #endif
337*69606e3fSchristos     "CO", "co",
338*69606e3fSchristos     "CPP", "$(CC) /preprocess_only",
339*69606e3fSchristos     "FC", "fortran",
340*69606e3fSchristos     /* System V uses these, so explicit rules using them should work.
341*69606e3fSchristos        However, there is no way to make implicit rules use them and FC.  */
342*69606e3fSchristos     "F77", "$(FC)",
343*69606e3fSchristos     "F77FLAGS", "$(FFLAGS)",
344*69606e3fSchristos     "LD", "link",
345*69606e3fSchristos     "LEX", "lex",
346*69606e3fSchristos     "PC", "pascal",
347*69606e3fSchristos     "YACC", "bison/yacc",
348*69606e3fSchristos     "YFLAGS", "/Define/Verbose",
349*69606e3fSchristos     "BISON", "bison",
350*69606e3fSchristos     "MAKEINFO", "makeinfo",
351*69606e3fSchristos     "TEX", "tex",
352*69606e3fSchristos     "TEXINDEX", "texindex",
353*69606e3fSchristos 
354*69606e3fSchristos     "RM", "delete/nolog",
355*69606e3fSchristos 
356*69606e3fSchristos     "CSTARTUP", "",
357*69606e3fSchristos #ifdef GCC_IS_NATIVE
358*69606e3fSchristos     "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
359*69606e3fSchristos     "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
360*69606e3fSchristos     "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
361*69606e3fSchristos     "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
362*69606e3fSchristos     "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
363*69606e3fSchristos #else
364*69606e3fSchristos     "CRT0", "",
365*69606e3fSchristos     "CXXSTARTUP", "",
366*69606e3fSchristos     "CXXRT0", "",
367*69606e3fSchristos     "LXLIBS", "",
368*69606e3fSchristos     "LDLIBS", "",
369*69606e3fSchristos #endif
370*69606e3fSchristos 
371*69606e3fSchristos     "LINK.obj", "$(LD) $(LDFLAGS)",
372*69606e3fSchristos #ifndef GCC_IS_NATIVE
373*69606e3fSchristos     "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
374*69606e3fSchristos     "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
375*69606e3fSchristos #endif
376*69606e3fSchristos     "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
377*69606e3fSchristos     "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
378*69606e3fSchristos     "YACC.y", "$(YACC) $(YFLAGS)",
379*69606e3fSchristos     "LEX.l", "$(LEX) $(LFLAGS)",
380*69606e3fSchristos     "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
381*69606e3fSchristos     "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
382*69606e3fSchristos     "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",
383*69606e3fSchristos     "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
384*69606e3fSchristos     "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
385*69606e3fSchristos 
386*69606e3fSchristos     "MV", "rename/new_version",
387*69606e3fSchristos     "CP", "copy",
388*69606e3fSchristos 
389*69606e3fSchristos #else /* !VMS */
390*69606e3fSchristos 
391*69606e3fSchristos     "AR", "ar",
392*69606e3fSchristos     "ARFLAGS", "rv",
393*69606e3fSchristos     "AS", "as",
394*69606e3fSchristos #ifdef GCC_IS_NATIVE
395*69606e3fSchristos     "CC", "gcc",
396*69606e3fSchristos # ifdef __MSDOS__
397*69606e3fSchristos     "CXX", "gpp",	/* g++ is an invalid name on MSDOS */
398*69606e3fSchristos # else
399*69606e3fSchristos     "CXX", "gcc",
400*69606e3fSchristos # endif /* __MSDOS__ */
401*69606e3fSchristos #else
402*69606e3fSchristos     "CC", "cc",
403*69606e3fSchristos     "CXX", "g++",
404*69606e3fSchristos #endif
405*69606e3fSchristos 
406*69606e3fSchristos     /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
407*69606e3fSchristos        and to the empty string if $@ does exist.  */
408*69606e3fSchristos     "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
409*69606e3fSchristos     "CO", "co",
410*69606e3fSchristos     "COFLAGS", "",
411*69606e3fSchristos 
412*69606e3fSchristos     "CPP", "$(CC) -E",
413*69606e3fSchristos #ifdef	CRAY
414*69606e3fSchristos     "CF77PPFLAGS", "-P",
415*69606e3fSchristos     "CF77PP", "/lib/cpp",
416*69606e3fSchristos     "CFT", "cft77",
417*69606e3fSchristos     "CF", "cf77",
418*69606e3fSchristos     "FC", "$(CF)",
419*69606e3fSchristos #else	/* Not CRAY.  */
420*69606e3fSchristos #ifdef	_IBMR2
421*69606e3fSchristos     "FC", "xlf",
422*69606e3fSchristos #else
423*69606e3fSchristos #ifdef	__convex__
424*69606e3fSchristos     "FC", "fc",
425*69606e3fSchristos #else
426*69606e3fSchristos     "FC", "f77",
427*69606e3fSchristos #endif /* __convex__ */
428*69606e3fSchristos #endif /* _IBMR2 */
429*69606e3fSchristos     /* System V uses these, so explicit rules using them should work.
430*69606e3fSchristos        However, there is no way to make implicit rules use them and FC.  */
431*69606e3fSchristos     "F77", "$(FC)",
432*69606e3fSchristos     "F77FLAGS", "$(FFLAGS)",
433*69606e3fSchristos #endif	/* Cray.  */
434*69606e3fSchristos     "GET", SCCS_GET,
435*69606e3fSchristos     "LD", "ld",
436*69606e3fSchristos #ifdef GCC_IS_NATIVE
437*69606e3fSchristos     "LEX", "flex",
438*69606e3fSchristos #else
439*69606e3fSchristos     "LEX", "lex",
440*69606e3fSchristos #endif
441*69606e3fSchristos     "LINT", "lint",
442*69606e3fSchristos     "M2C", "m2c",
443*69606e3fSchristos #ifdef	pyr
444*69606e3fSchristos     "PC", "pascal",
445*69606e3fSchristos #else
446*69606e3fSchristos #ifdef	CRAY
447*69606e3fSchristos     "PC", "PASCAL",
448*69606e3fSchristos     "SEGLDR", "segldr",
449*69606e3fSchristos #else
450*69606e3fSchristos     "PC", "pc",
451*69606e3fSchristos #endif	/* CRAY.  */
452*69606e3fSchristos #endif	/* pyr.  */
453*69606e3fSchristos #ifdef GCC_IS_NATIVE
454*69606e3fSchristos     "YACC", "bison -y",
455*69606e3fSchristos #else
456*69606e3fSchristos     "YACC", "yacc",	/* Or "bison -y"  */
457*69606e3fSchristos #endif
458*69606e3fSchristos     "MAKEINFO", "makeinfo",
459*69606e3fSchristos     "TEX", "tex",
460*69606e3fSchristos     "TEXI2DVI", "texi2dvi",
461*69606e3fSchristos     "WEAVE", "weave",
462*69606e3fSchristos     "CWEAVE", "cweave",
463*69606e3fSchristos     "TANGLE", "tangle",
464*69606e3fSchristos     "CTANGLE", "ctangle",
465*69606e3fSchristos 
466*69606e3fSchristos     "RM", "rm -f",
467*69606e3fSchristos 
468*69606e3fSchristos     "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
469*69606e3fSchristos     "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
470*69606e3fSchristos     "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
471*69606e3fSchristos     "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
472*69606e3fSchristos     "COMPILE.C", "$(COMPILE.cc)",
473*69606e3fSchristos     "COMPILE.cpp", "$(COMPILE.cc)",
474*69606e3fSchristos     "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
475*69606e3fSchristos     "LINK.C", "$(LINK.cc)",
476*69606e3fSchristos     "LINK.cpp", "$(LINK.cc)",
477*69606e3fSchristos     "YACC.y", "$(YACC) $(YFLAGS)",
478*69606e3fSchristos     "LEX.l", "$(LEX) $(LFLAGS) -t",
479*69606e3fSchristos     "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
480*69606e3fSchristos     "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
481*69606e3fSchristos     "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
482*69606e3fSchristos     "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
483*69606e3fSchristos     "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
484*69606e3fSchristos     "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
485*69606e3fSchristos     "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
486*69606e3fSchristos     "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
487*69606e3fSchristos     "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
488*69606e3fSchristos     "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
489*69606e3fSchristos     "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
490*69606e3fSchristos     "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
491*69606e3fSchristos     "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
492*69606e3fSchristos     "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
493*69606e3fSchristos     "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
494*69606e3fSchristos     "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
495*69606e3fSchristos     "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
496*69606e3fSchristos     "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
497*69606e3fSchristos 
498*69606e3fSchristos #ifndef	NO_MINUS_C_MINUS_O
499*69606e3fSchristos     "OUTPUT_OPTION", "-o $@",
500*69606e3fSchristos #endif
501*69606e3fSchristos 
502*69606e3fSchristos #ifdef	SCCS_GET_MINUS_G
503*69606e3fSchristos     "SCCS_OUTPUT_OPTION", "-G$@",
504*69606e3fSchristos #endif
505*69606e3fSchristos 
506*69606e3fSchristos #ifdef _AMIGA
507*69606e3fSchristos     ".LIBPATTERNS", "%.lib",
508*69606e3fSchristos #else
509*69606e3fSchristos #ifdef __MSDOS__
510*69606e3fSchristos     ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
511*69606e3fSchristos #else
512*69606e3fSchristos     ".LIBPATTERNS", "lib%.so lib%.a",
513*69606e3fSchristos #endif
514*69606e3fSchristos #endif
515*69606e3fSchristos 
516*69606e3fSchristos #endif /* !VMS */
517*69606e3fSchristos     0, 0
518*69606e3fSchristos   };
519*69606e3fSchristos 
520*69606e3fSchristos /* Set up the default .SUFFIXES list.  */
521*69606e3fSchristos 
522*69606e3fSchristos void
set_default_suffixes(void)523*69606e3fSchristos set_default_suffixes (void)
524*69606e3fSchristos {
525*69606e3fSchristos   suffix_file = enter_file (".SUFFIXES");
526*69606e3fSchristos 
527*69606e3fSchristos   if (no_builtin_rules_flag)
528*69606e3fSchristos     (void) define_variable ("SUFFIXES", 8, "", o_default, 0);
529*69606e3fSchristos   else
530*69606e3fSchristos     {
531*69606e3fSchristos       char *p = default_suffixes;
532*69606e3fSchristos       suffix_file->deps = (struct dep *)
533*69606e3fSchristos 	multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1),
534*69606e3fSchristos 		    sizeof (struct dep));
535*69606e3fSchristos       (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);
536*69606e3fSchristos     }
537*69606e3fSchristos }
538*69606e3fSchristos 
539*69606e3fSchristos /* Enter the default suffix rules as file rules.  This used to be done in
540*69606e3fSchristos    install_default_implicit_rules, but that loses because we want the
541*69606e3fSchristos    suffix rules installed before reading makefiles, and thee pattern rules
542*69606e3fSchristos    installed after.  */
543*69606e3fSchristos 
544*69606e3fSchristos void
install_default_suffix_rules(void)545*69606e3fSchristos install_default_suffix_rules (void)
546*69606e3fSchristos {
547*69606e3fSchristos   register char **s;
548*69606e3fSchristos 
549*69606e3fSchristos   if (no_builtin_rules_flag)
550*69606e3fSchristos     return;
551*69606e3fSchristos 
552*69606e3fSchristos  for (s = default_suffix_rules; *s != 0; s += 2)
553*69606e3fSchristos     {
554*69606e3fSchristos       register struct file *f = enter_file (s[0]);
555*69606e3fSchristos       /* Don't clobber cmds given in a makefile if there were any.  */
556*69606e3fSchristos       if (f->cmds == 0)
557*69606e3fSchristos 	{
558*69606e3fSchristos 	  f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
559*69606e3fSchristos 	  f->cmds->fileinfo.filenm = 0;
560*69606e3fSchristos 	  f->cmds->commands = s[1];
561*69606e3fSchristos 	  f->cmds->command_lines = 0;
562*69606e3fSchristos 	}
563*69606e3fSchristos     }
564*69606e3fSchristos }
565*69606e3fSchristos 
566*69606e3fSchristos 
567*69606e3fSchristos /* Install the default pattern rules.  */
568*69606e3fSchristos 
569*69606e3fSchristos void
install_default_implicit_rules(void)570*69606e3fSchristos install_default_implicit_rules (void)
571*69606e3fSchristos {
572*69606e3fSchristos   register struct pspec *p;
573*69606e3fSchristos 
574*69606e3fSchristos   if (no_builtin_rules_flag)
575*69606e3fSchristos     return;
576*69606e3fSchristos 
577*69606e3fSchristos   for (p = default_pattern_rules; p->target != 0; ++p)
578*69606e3fSchristos     install_pattern_rule (p, 0);
579*69606e3fSchristos 
580*69606e3fSchristos   for (p = default_terminal_rules; p->target != 0; ++p)
581*69606e3fSchristos     install_pattern_rule (p, 1);
582*69606e3fSchristos }
583*69606e3fSchristos 
584*69606e3fSchristos void
define_default_variables(void)585*69606e3fSchristos define_default_variables (void)
586*69606e3fSchristos {
587*69606e3fSchristos   register char **s;
588*69606e3fSchristos 
589*69606e3fSchristos   if (no_builtin_variables_flag)
590*69606e3fSchristos     return;
591*69606e3fSchristos 
592*69606e3fSchristos   for (s = default_variables; *s != 0; s += 2)
593*69606e3fSchristos     (void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
594*69606e3fSchristos }
595