OSDN Git Service

* runtime directory -- moved into "libfc2" in the toplevel
[pf3gnuchains/gcc-fork.git] / gcc / f / Make-lang.in
1 # Top level makefile fragment for GNU Fortran.           -*-makefile-*-
2 #   Copyright (C) 1995-1997 Free Software Foundation, Inc.
3
4 #This file is part of GNU Fortran.
5
6 #GNU Fortran is free software; you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation; either version 2, or (at your option)
9 #any later version.
10
11 #GNU Fortran is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #GNU General Public License for more details.
15
16 #You should have received a copy of the GNU General Public License
17 #along with GNU Fortran; see the file COPYING.  If not, write to
18 #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 #02111-1307, USA.
20
21 # This file provides the language dependent support in the main Makefile.
22 # Each language makefile fragment must provide the following targets:
23 #
24 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
25 # foo.info, foo.dvi,
26 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
27 # foo.uninstall, foo.distdir,
28 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
29 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
30 #
31 # where `foo' is the name of the language.
32 #
33 # It should also provide rules for:
34 #
35 # - making any compiler driver (eg: g77)
36 # - the compiler proper (eg: f771)
37 # - define the names for selecting the language in LANGUAGES.
38 #
39 # $(srcdir) must be set to the gcc/ source directory (not gcc/f/).
40 #\f
41 # Extra flags to pass to recursive makes (and to sub-configure).
42 # Use different quoting rules compared with FLAGS_TO_PASS so we can use
43 # this to set environment variables as well
44 # Note that GCC_FOR_TARGET, GCC_FLAGS aren't in here -- treated separately.
45 F77_FLAGS_TO_PASS = \
46         CROSS="$(CROSS)" \
47         AR_FLAGS="$(AR_FLAGS)" \
48         AR="$(AR)" \
49         BISON="$(BISON)" \
50         BISONFLAGS="$(BISONFLAGS)" \
51         CC="$(CC)" \
52         CFLAGS="$(CFLAGS)" \
53         X_CFLAGS="$(X_CFLAGS)" \
54         LDFLAGS="$(LDFLAGS)" \
55         LEX="$(LEX)" \
56         LEXFLAGS="$(LEXFLAGS)" \
57         MAKEINFO="$(MAKEINFO)" \
58         MAKEINFOFLAGS="$(MAKEINFOFLAGS)" \
59         RANLIB="$(RANLIB)" \
60         RANLIB_TEST="$(RANLIB_TEST)" \
61         SHELL="$(SHELL)" \
62         exec_prefix="$(exec_prefix)" \
63         prefix="$(prefix)" \
64         tooldir="$(tooldir)" \
65         bindir="$(bindir)" \
66         libsubdir="$(libsubdir)"
67 #       "F77_FOR_BUILD=$(F77_FOR_BUILD)" \
68 #       "F77FLAGS=$(F77FLAGS)" \
69 #       "F77_FOR_TARGET=$(F77_FOR_TARGET)"
70
71 # This flag controls whether to install (overwrite) f77 on this system,
72 # and also whether to uninstall it when using the uninstall target.
73 # As shipped, the flag is a test of whether the `f77_install_ok'
74 # file exists in the build or source directories (top level), but
75 # you can just change it here if you like.
76 F77_INSTALL_FLAG = [ -f f77-install-ok -o -f $(srcdir)/f77-install-ok ]
77
78 # Actual names to use when installing a native compiler.
79 F77_INSTALL_NAME = `t='$(program_transform_name)'; echo f77 | sed $$t`
80 G77_INSTALL_NAME = `t='$(program_transform_name)'; echo g77 | sed $$t`
81
82 # Actual names to use when installing a cross-compiler.
83 F77_CROSS_NAME = `t='$(program_transform_cross_name)'; echo f77 | sed $$t`
84 G77_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g77 | sed $$t`
85 #\f
86 # Define the names for selecting f77 in LANGUAGES.
87 # Note that it would be nice to move the dependency on g77
88 # into the F77 rule, but that needs a little bit of work
89 # to do the right thing within all.cross.
90 F77 f77: f771
91
92 # Tell GNU make to ignore these if they exist.
93 .PHONY: F77 f77 f77.all.build f77.all.cross \
94   f77.start.encap f77.rest.encap f77.info f77.dvi \
95   f77.install-normal install-libf77 \
96   f77.install-common f77.install-info f77.install-man \
97   f77.uninstall f77.mostlyclean f77.clean f77.distclean \
98   f77.maintainer-clean f77.realclean f77.stage1 f77.stage2 f77.stage3 \
99   f77.stage4 f77.distdir f77.rebuilt
100
101 g77.c: $(srcdir)/gcc.c
102         -rm -f $@
103         $(LN_S) $(srcdir)/gcc.c $@
104
105 g77spec.o: $(srcdir)/f/g77spec.c
106         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/f/g77spec.c
107
108 # N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
109 # It'd be nice if we could find an easier way to do this---rather than have
110 # to track changes to the toplevel gcc Makefile as well.
111 # We depend on g77.c last, to make it obvious where it came from.
112 g77.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g77.c
113         $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
114         $(DRIVER_DEFINES) \
115         -DLANG_SPECIFIC_DRIVER -c g77.c
116
117 # Create the compiler driver for g77.
118 g77$(exeext): g77.o g77spec.o version.o choose-temp.o pexecute.o prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
119         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g77.o g77spec.o prefix.o version.o \
120           choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
121
122 # Create a version of the g77 driver which calls the cross-compiler.
123 g77-cross$(exeext): g77$(exeext)
124         -rm -f g77-cross$(exeext)
125         cp g77$(exeext) g77-cross$(exeext)
126
127 F77_SRCS = \
128  $(srcdir)/f/assert.j \
129  $(srcdir)/f/bad.c \
130  $(srcdir)/f/bad.def \
131  $(srcdir)/f/bad.h \
132  $(srcdir)/f/bit.c \
133  $(srcdir)/f/bit.h \
134  $(srcdir)/f/bld-op.def \
135  $(srcdir)/f/bld.c \
136  $(srcdir)/f/bld.h \
137  $(srcdir)/f/com-rt.def \
138  $(srcdir)/f/com.c \
139  $(srcdir)/f/com.h \
140  $(srcdir)/f/config.j \
141  $(srcdir)/f/convert.j \
142  $(srcdir)/f/data.c \
143  $(srcdir)/f/data.h \
144  $(srcdir)/f/equiv.c \
145  $(srcdir)/f/equiv.h \
146  $(srcdir)/f/expr.c \
147  $(srcdir)/f/expr.h \
148  $(srcdir)/f/fini.c \
149  $(srcdir)/f/flags.j \
150  $(srcdir)/f/glimits.j \
151  $(srcdir)/f/global.c \
152  $(srcdir)/f/global.h \
153  $(srcdir)/f/hconfig.j \
154  $(srcdir)/f/implic.c \
155  $(srcdir)/f/implic.h \
156  $(srcdir)/f/input.j \
157  $(srcdir)/f/info-b.def \
158  $(srcdir)/f/info-k.def \
159  $(srcdir)/f/info-w.def \
160  $(srcdir)/f/info.c \
161  $(srcdir)/f/info.h \
162  $(srcdir)/f/intrin.c \
163  $(srcdir)/f/intrin.def \
164  $(srcdir)/f/intrin.h \
165  $(srcdir)/f/lab.c \
166  $(srcdir)/f/lab.h \
167  $(srcdir)/f/lex.c \
168  $(srcdir)/f/lex.h \
169  $(srcdir)/f/malloc.c \
170  $(srcdir)/f/malloc.h \
171  $(srcdir)/f/name.c \
172  $(srcdir)/f/name.h \
173  $(srcdir)/f/parse.c \
174  $(srcdir)/f/proj.c \
175  $(srcdir)/f/proj.h \
176  $(srcdir)/f/rtl.j \
177  $(srcdir)/f/src.c \
178  $(srcdir)/f/src.h \
179  $(srcdir)/f/st.c \
180  $(srcdir)/f/st.h \
181  $(srcdir)/f/sta.c \
182  $(srcdir)/f/sta.h \
183  $(srcdir)/f/stb.c \
184  $(srcdir)/f/stb.h \
185  $(srcdir)/f/stc.c \
186  $(srcdir)/f/stc.h \
187  $(srcdir)/f/std.c \
188  $(srcdir)/f/std.h \
189  $(srcdir)/f/ste.c \
190  $(srcdir)/f/ste.h \
191  $(srcdir)/f/storag.c \
192  $(srcdir)/f/storag.h \
193  $(srcdir)/f/stp.c \
194  $(srcdir)/f/stp.h \
195  $(srcdir)/f/str-1t.fin \
196  $(srcdir)/f/str-2t.fin \
197  $(srcdir)/f/str-fo.fin \
198  $(srcdir)/f/str-io.fin \
199  $(srcdir)/f/str-nq.fin \
200  $(srcdir)/f/str-op.fin \
201  $(srcdir)/f/str-ot.fin \
202  $(srcdir)/f/str.c \
203  $(srcdir)/f/str.h \
204  $(srcdir)/f/sts.c \
205  $(srcdir)/f/sts.h \
206  $(srcdir)/f/stt.c \
207  $(srcdir)/f/stt.h \
208  $(srcdir)/f/stu.c \
209  $(srcdir)/f/stu.h \
210  $(srcdir)/f/stv.c \
211  $(srcdir)/f/stv.h \
212  $(srcdir)/f/stw.c \
213  $(srcdir)/f/stw.h \
214  $(srcdir)/f/symbol.c \
215  $(srcdir)/f/symbol.def \
216  $(srcdir)/f/symbol.h \
217  $(srcdir)/f/target.c \
218  $(srcdir)/f/target.h \
219  $(srcdir)/f/tconfig.j \
220  $(srcdir)/f/tm.j \
221  $(srcdir)/f/top.c \
222  $(srcdir)/f/top.h \
223  $(srcdir)/f/tree.j \
224  $(srcdir)/f/type.c \
225  $(srcdir)/f/type.h \
226  $(srcdir)/f/version.c \
227  $(srcdir)/f/version.h \
228  $(srcdir)/f/where.c \
229  $(srcdir)/f/where.h
230
231 f771: $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist f/Makefile
232         $(MAKE) -f f/Makefile $(FLAGS_TO_PASS) VPATH=$(srcdir) srcdir=$(srcdir) f771
233
234 f/Makefile: $(srcdir)/f/Makefile.in $(srcdir)/configure
235         $(SHELL) config.status
236
237 #\f
238 # Build hooks:
239
240 f77.all.build: g77$(exeext)
241 f77.all.cross: g77-cross$(exeext)
242 f77.start.encap: g77$(exeext)
243 f77.rest.encap:
244
245 f77.info: f/g77.info
246 f77.dvi: f/g77.dvi
247
248 # g77 documentation.
249 f/g77.info: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
250             $(srcdir)/f/g77install.texi $(srcdir)/f/news.texi \
251             $(srcdir)/f/intdoc.texi
252         $(MAKEINFO) -I$(srcdir)/f $(srcdir)/f/g77.texi -o f/g77.info
253
254 f/g77.dvi: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
255                      $(srcdir)/f/g77install.texi $(srcdir)/f/news.texi \
256                      $(srcdir)/f/intdoc.texi
257         $(TEXI2DVI) -I$(srcdir)/f $(srcdir)/f/g77.texi -o f/g77.dvi
258
259 # This dance is all about producing accurate documentation for g77's
260 # intrinsics with minimum fuss.  f/ansify appends "\n\" to C strings
261 # so ANSI C compilers can compile f/intdoc.h -- gcc can compile f/intdoc.in
262 # directly, if f/intdoc.c #include'd that, but we don't want to force
263 # people to install gcc just to build the documentation.  We use the
264 # C format for f/intdoc.in in the first place to allow a fairly "free",
265 # but widely known format for documentation -- basically anyone who knows
266 # how to write texinfo source and enclose it in C constants can handle
267 # it, and f/ansify allows them to not even end lines with "\n\".  So,
268 # essentially, the C preprocessor and compiler are used to enter the
269 # document snippets into a data base via name lookup, rather than duplicating
270 # that kind of code here.  And we use f/intdoc.c instead of straight
271 # texinfo in the first place so that as much information as possible
272 # contained in f/intrin.def can be inserted directly and reliably into
273 # the documentation.  That's better than replicating it, because it
274 # reduces the likelihood of discrepancies between the docs and the compiler
275 # itself, which uses f/intrin.def; in fact, many bugs in f/intrin.def have
276 # been found only upon reading the documentation that was automatically
277 # produced from it.
278 $(srcdir)/f/intdoc.texi: f/intdoc.c f/intdoc.in f/ansify.c f/intrin.def f/intrin.h
279         $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) \
280               `echo $(srcdir)/f/ansify.c | sed 's,^\./,,'` -o f/ansify
281         f/ansify < $(srcdir)/f/intdoc.in > f/intdoc.h0 $(srcdir)/f/intdoc.in
282         $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -I./f \
283               `echo $(srcdir)/f/intdoc.c | sed 's,^\./,,'` -o f/intdoc
284         f/intdoc > $(srcdir)/f/intdoc.texi
285         rm f/intdoc f/ansify f/intdoc.h0
286
287 $(srcdir)/f/BUGS: f/bugs0.texi f/bugs.texi
288         cd $(srcdir)/f; $(MAKEINFO) -D BUGSONLY --no-header --no-split \
289           --no-validate bugs0.texi -o BUGS
290
291 $(srcdir)/f/INSTALL: f/install0.texi f/g77install.texi
292         cd $(srcdir)/f; $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
293           --no-validate install0.texi -o INSTALL
294
295 $(srcdir)/f/NEWS: f/news0.texi f/news.texi
296         cd $(srcdir)/f; $(MAKEINFO) -D NEWSONLY --no-header --no-split \
297           --no-validate news0.texi -o NEWS
298
299 f77.rebuilt: $(srcdir)/f/g77.info $(srcdir)/f/BUGS $(srcdir)/f/INSTALL \
300   $(srcdir)/f/NEWS 
301
302 #\f
303 # Install hooks:
304 # f771 is installed elsewhere as part of $(COMPILERS).
305
306 f77.install-normal: install-libf77
307
308 # Install the driver program as $(target)-g77
309 # and also as either g77 (if native) or $(tooldir)/bin/g77.
310 f77.install-common:
311         -if [ -f f771$(exeext) ] ; then \
312           if [ -f g77-cross$(exeext) ] ; then \
313             rm -f $(bindir)/$(G77_CROSS_NAME)$(exeext); \
314             $(INSTALL_PROGRAM) g77-cross$(exeext) $(bindir)/$(G77_CROSS_NAME)$(exeext); \
315             chmod a+x $(bindir)/$(G77_CROSS_NAME)$(exeext); \
316             if $(F77_INSTALL_FLAG) ; then \
317               rm -f $(bindir)/$(F77_CROSS_NAME)$(exeext); \
318               $(LN) $(bindir)/$(G77_CROSS_NAME)$(exeext) $(bindir)/$(F77_CROSS_NAME)$(exeext); \
319             fi ; \
320           else \
321             rm -f $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
322             $(INSTALL_PROGRAM) g77$(exeext) $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
323             chmod a+x $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
324             if $(F77_INSTALL_FLAG) ; then \
325               rm -f $(bindir)/$(F77_INSTALL_NAME)$(exeext); \
326               $(LN) $(bindir)/$(G77_INSTALL_NAME)$(exeext) $(bindir)/$(F77_INSTALL_NAME)$(exeext); \
327             fi ; \
328           fi ; \
329         else true; fi
330
331 # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
332 # to do the install.  The sed rule was copied from stmp-int-hdrs.
333 f77.install-info: f77.info
334         -rm -f $(infodir)/g77.info*
335         for f in f/g77.info*; do \
336             realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
337             $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
338         done
339         -chmod a-x $(infodir)/g77.info*
340
341 f77.install-man: $(srcdir)/f/g77.1
342         -if [ -f f771$(exeext) ] ; then \
343           if [ -f g77-cross$(exeext) ] ; then \
344             rm -f $(mandir)/$(G77_CROSS_NAME)$(manext); \
345             $(INSTALL_DATA) $(srcdir)/f/g77.1 $(mandir)/$(G77_CROSS_NAME)$(manext); \
346             chmod a-x $(mandir)/$(G77_CROSS_NAME)$(manext); \
347             if $(F77_INSTALL_FLAG) ; then \
348               rm -f $(mandir)/$(F77_CROSS_NAME)$(manext); \
349               $(LN) $(mandir)/$(G77_CROSS_NAME)$(manext) $(mandir)/$(F77_CROSS_NAME)$(manext); \
350             fi ;\
351           else \
352             rm -f $(mandir)/$(G77_INSTALL_NAME)$(manext); \
353             $(INSTALL_DATA) $(srcdir)/f/g77.1 $(mandir)/$(G77_INSTALL_NAME)$(manext); \
354             chmod a-x $(mandir)/$(G77_INSTALL_NAME)$(manext); \
355             if $(F77_INSTALL_FLAG) ; then \
356               rm -f $(mandir)/$(F77_INSTALL_NAME)$(manext); \
357               $(LN) $(mandir)/$(G77_INSTALL_NAME)$(manext) $(mandir)/$(F77_INSTALL_NAME)$(manext); \
358             fi ;\
359           fi; \
360         else true; fi
361
362 f77.uninstall:
363         -if $(F77_INSTALL_FLAG) ; then \
364           rm -rf $(bindir)/$(F77_INSTALL_NAME)$(exeext) ; \
365           rm -rf $(bindir)/$(F77_CROSS_NAME)$(exeext) ; \
366           rm -rf $(mandir)/$(F77_INSTALL_NAME)$(manext) ; \
367           rm -rf $(mandir)/$(F77_CROSS_NAME)$(manext) ; \
368         fi
369         -rm -rf $(bindir)/$(G77_INSTALL_NAME)$(exeext)
370         -rm -rf $(bindir)/$(G77_CROSS_NAME)$(exeext)
371         -rm -rf $(mandir)/$(G77_INSTALL_NAME)$(manext)
372         -rm -rf $(mandir)/$(G77_CROSS_NAME)$(manext)
373         -rm -rf $(infodir)/g77.info*
374 #\f
375 # Clean hooks:
376 # A lot of the ancillary files are deleted by the main makefile.
377 # We just have to delete files specific to us.
378
379 f77.mostlyclean:
380         -rm -f f/*$(objext)
381         -rm -f f/fini f/f771 f/stamp-str f/str-*.h f/str-*.j f/intdoc f/ansify f/intdoc.h0
382 f77.clean:
383         -rm -f g77.c
384 f77.distclean:
385         -rm -f f/Makefile
386 # realclean is the pre-2.7.0 name for maintainer-clean
387 f77.maintainer-clean f77.realclean: f77.distclean
388         -rm -f f/g77.info* f/g77.*aux f/TAGS f/BUGS f/INSTALL f/NEWS f/intdoc.texi
389 #\f
390 # Stage hooks:
391 # The main makefile has already created stage?/f.
392
393 G77STAGESTUFF = f/*$(objext) f/fini f/stamp-str f/str-*.h f/str-*.j
394
395 f77.stage1: stage1-start
396         -mv $(G77STAGESTUFF) stage1/f
397 f77.stage2: stage2-start
398         -mv $(G77STAGESTUFF) stage2/f
399 f77.stage3: stage3-start
400         -mv $(G77STAGESTUFF) stage3/f
401 f77.stage4: stage4-start
402         -mv $(G77STAGESTUFF) stage4/f
403 #\f
404 # Maintenance hooks:
405
406 # This target creates the files that can be rebuilt, but go in the
407 # distribution anyway.  It then copies the files to the distdir directory.
408 f77.distdir: f77.rebuilt
409         mkdir tmp/f
410         cd f; \
411         for file in *[0-9a-zA-Z+]; do \
412           ($LN) $$file ../tmp/f
413         done