OSDN Git Service

Mon Jul 13 18:45:06 1998 Craig Burley <burley@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / f / Make-lang.in
1 # Top level makefile fragment for GNU Fortran.           -*-makefile-*-
2 #   Copyright (C) 1995-1998 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,
19 #Boston, MA 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: g++)
36 # - the compiler proper (eg: cc1plus)
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 # Actual name to use when installing a native compiler.
42 G77_INSTALL_NAME = `t='$(program_transform_name)'; echo g77 | sed $$t`
43
44 # Actual name to use when installing a cross-compiler.
45 G77_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g77 | sed $$t`
46 #\f
47 # Define the names for selecting f77 in LANGUAGES.
48 # Note that it would be nice to move the dependency on g77
49 # into the F77 rule, but that needs a little bit of work
50 # to do the right thing within all.cross.
51 F77 f77: f771$(exeext)
52
53 # Tell GNU make to ignore these if they exist.
54 .PHONY: F77 f77 f77.all.build f77.all.cross \
55   f77.start.encap f77.rest.encap f77.info f77.dvi \
56   f77.install-normal \
57   f77.install-common f77.install-info f77.install-man \
58   f77.uninstall f77.mostlyclean f77.clean f77.distclean \
59   f77.extraclean f77.maintainer-clean f77.distdir f77.rebuilt \
60   f77.stage1 f77.stage2 f77.stage3 f77.stage4
61
62 g77.c: $(srcdir)/gcc.c
63         case "$(LANGUAGES)" in \
64           *[fF]77*) touch lang-f77;; \
65           *) rm -f lang-f77;; \
66         esac
67         if [ -f lang-f77 ]; then \
68           rm -f g77.c; \
69           $(LN_S) $(srcdir)/gcc.c g77.c; \
70         fi
71
72 g77spec.o: $(srcdir)/f/g77spec.c $(srcdir)/f/version.h
73         case "$(LANGUAGES)" in \
74           *[fF]77*) touch lang-f77;; \
75           *) rm -f lang-f77;; \
76         esac
77         if [ -f lang-f77 ]; then \
78           $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/f/g77spec.c; \
79         fi
80
81 g77version.o: $(srcdir)/f/version.c
82         case "$(LANGUAGES)" in \
83           *[fF]77*) touch lang-f77;; \
84           *) rm -f lang-f77;; \
85         esac
86         if [ -f lang-f77 ]; then \
87           $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -o g77version.o \
88             $(srcdir)/f/version.c; \
89         fi
90
91 # N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
92 # It'd be nice if we could find an easier way to do this---rather than have
93 # to track changes to the toplevel gcc Makefile as well.
94 # We depend on g77.c last, to make it obvious where it came from.
95 g77.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g77.c
96         if [ -f lang-f77 ]; then \
97           $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(DRIVER_DEFINES) \
98            -DLANG_SPECIFIC_DRIVER -c g77.c; \
99         fi
100
101 # Create the compiler driver for g77.
102 g77$(exeext): g77.o g77spec.o g77version.o version.o choose-temp.o pexecute.o prefix.o mkstemp.o \
103   $(LIBDEPS) $(EXTRA_GCC_OBJS)
104         if [ -f lang-f77 ]; then \
105           $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g77.o g77spec.o g77version.o \
106            version.o choose-temp.o pexecute.o prefix.o mkstemp.o $(EXTRA_GCC_OBJS) $(LIBS); \
107         fi
108
109 # Create a version of the g77 driver which calls the cross-compiler.
110 g77-cross$(exeext): g77$(exeext)
111         if [ -f lang-f77 ]; then \
112           rm -f g77-cross$(exeext); \
113           cp g77$(exeext) g77-cross$(exeext); \
114         fi
115
116 F77_SRCS = \
117  $(srcdir)/f/assert.j \
118  $(srcdir)/f/bad.c \
119  $(srcdir)/f/bad.def \
120  $(srcdir)/f/bad.h \
121  $(srcdir)/f/bit.c \
122  $(srcdir)/f/bit.h \
123  $(srcdir)/f/bld-op.def \
124  $(srcdir)/f/bld.c \
125  $(srcdir)/f/bld.h \
126  $(srcdir)/f/com-rt.def \
127  $(srcdir)/f/com.c \
128  $(srcdir)/f/com.h \
129  $(srcdir)/f/config.j \
130  $(srcdir)/f/convert.j \
131  $(srcdir)/f/data.c \
132  $(srcdir)/f/data.h \
133  $(srcdir)/f/equiv.c \
134  $(srcdir)/f/equiv.h \
135  $(srcdir)/f/expr.c \
136  $(srcdir)/f/expr.h \
137  $(srcdir)/f/fini.c \
138  $(srcdir)/f/flags.j \
139  $(srcdir)/f/glimits.j \
140  $(srcdir)/f/global.c \
141  $(srcdir)/f/global.h \
142  $(srcdir)/f/hconfig.j \
143  $(srcdir)/f/implic.c \
144  $(srcdir)/f/implic.h \
145  $(srcdir)/f/input.j \
146  $(srcdir)/f/info-b.def \
147  $(srcdir)/f/info-k.def \
148  $(srcdir)/f/info-w.def \
149  $(srcdir)/f/info.c \
150  $(srcdir)/f/info.h \
151  $(srcdir)/f/intrin.c \
152  $(srcdir)/f/intrin.def \
153  $(srcdir)/f/intrin.h \
154  $(srcdir)/f/lab.c \
155  $(srcdir)/f/lab.h \
156  $(srcdir)/f/lex.c \
157  $(srcdir)/f/lex.h \
158  $(srcdir)/f/malloc.c \
159  $(srcdir)/f/malloc.h \
160  $(srcdir)/f/name.c \
161  $(srcdir)/f/name.h \
162  $(srcdir)/f/output.j \
163  $(srcdir)/f/parse.c \
164  $(srcdir)/f/proj.c \
165  $(srcdir)/f/proj.h \
166  $(srcdir)/f/rtl.j \
167  $(srcdir)/f/src.c \
168  $(srcdir)/f/src.h \
169  $(srcdir)/f/st.c \
170  $(srcdir)/f/st.h \
171  $(srcdir)/f/sta.c \
172  $(srcdir)/f/sta.h \
173  $(srcdir)/f/stb.c \
174  $(srcdir)/f/stb.h \
175  $(srcdir)/f/stc.c \
176  $(srcdir)/f/stc.h \
177  $(srcdir)/f/std.c \
178  $(srcdir)/f/std.h \
179  $(srcdir)/f/ste.c \
180  $(srcdir)/f/ste.h \
181  $(srcdir)/f/storag.c \
182  $(srcdir)/f/storag.h \
183  $(srcdir)/f/stp.c \
184  $(srcdir)/f/stp.h \
185  $(srcdir)/f/str-1t.fin \
186  $(srcdir)/f/str-2t.fin \
187  $(srcdir)/f/str-fo.fin \
188  $(srcdir)/f/str-io.fin \
189  $(srcdir)/f/str-nq.fin \
190  $(srcdir)/f/str-op.fin \
191  $(srcdir)/f/str-ot.fin \
192  $(srcdir)/f/str.c \
193  $(srcdir)/f/str.h \
194  $(srcdir)/f/sts.c \
195  $(srcdir)/f/sts.h \
196  $(srcdir)/f/stt.c \
197  $(srcdir)/f/stt.h \
198  $(srcdir)/f/stu.c \
199  $(srcdir)/f/stu.h \
200  $(srcdir)/f/stv.c \
201  $(srcdir)/f/stv.h \
202  $(srcdir)/f/stw.c \
203  $(srcdir)/f/stw.h \
204  $(srcdir)/f/symbol.c \
205  $(srcdir)/f/symbol.def \
206  $(srcdir)/f/symbol.h \
207  $(srcdir)/f/system.j \
208  $(srcdir)/f/target.c \
209  $(srcdir)/f/target.h \
210  $(srcdir)/f/tconfig.j \
211  $(srcdir)/f/tm.j \
212  $(srcdir)/f/top.c \
213  $(srcdir)/f/top.h \
214  $(srcdir)/f/toplev.j \
215  $(srcdir)/f/tree.j \
216  $(srcdir)/f/type.c \
217  $(srcdir)/f/type.h \
218  $(srcdir)/f/version.c \
219  $(srcdir)/f/version.h \
220  $(srcdir)/f/where.c \
221  $(srcdir)/f/where.h
222
223 f771$(exeext): $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist
224         touch lang-f77
225         cd f; $(MAKE) $(FLAGS_TO_PASS) \
226           HOST_CC="$(HOST_CC)" HOST_CFLAGS="$(HOST_CFLAGS)" HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \
227           ../f771$(exeext)
228
229 #\f
230 # Build hooks:
231
232 f77.all.build: g77$(exeext)
233 f77.all.cross: g77-cross$(exeext)
234 f77.start.encap: g77$(exeext)
235 f77.rest.encap:
236
237 f77.info: f/g77.info
238 f77.dvi: f/g77.dvi
239
240 # g77 documentation.
241 f/g77.info: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
242             $(srcdir)/f/g77install.texi $(srcdir)/f/news.texi \
243             $(srcdir)/f/intdoc.texi
244         case "$(LANGUAGES)" in \
245           *[fF]77*) touch lang-f77;; \
246           *) rm -f lang-f77;; \
247         esac
248         if [ -f lang-f77 ]; then \
249           rm -f $(srcdir)/f/g77.info-*; \
250           $(MAKEINFO) -I$(srcdir)/f -o f/g77.info $(srcdir)/f/g77.texi; \
251         fi
252
253 f/g77.dvi: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
254             $(srcdir)/f/g77install.texi $(srcdir)/f/news.texi \
255             $(srcdir)/f/intdoc.texi
256         case "$(LANGUAGES)" in \
257           *[fF]77*) touch lang-f77;; \
258           *) rm -f lang-f77;; \
259         esac
260         if [ -f lang-f77 ]; then \
261           $(TEXI2DVI) -I$(srcdir)/f -o f/g77.dvi $(srcdir)/f/g77.texi; \
262         fi
263
264 # This dance is all about producing accurate documentation for g77's
265 # intrinsics with minimum fuss.  f/ansify appends "\n\" to C strings
266 # so ANSI C compilers can compile f/intdoc.h -- gcc can compile f/intdoc.in
267 # directly, if f/intdoc.c #include'd that, but we don't want to force
268 # people to install gcc just to build the documentation.  We use the
269 # C format for f/intdoc.in in the first place to allow a fairly "free",
270 # but widely known format for documentation -- basically anyone who knows
271 # how to write texinfo source and enclose it in C constants can handle
272 # it, and f/ansify allows them to not even end lines with "\n\".  So,
273 # essentially, the C preprocessor and compiler are used to enter the
274 # document snippets into a data base via name lookup, rather than duplicating
275 # that kind of code here.  And we use f/intdoc.c instead of straight
276 # texinfo in the first place so that as much information as possible
277 # contained in f/intrin.def can be inserted directly and reliably into
278 # the documentation.  That's better than replicating it, because it
279 # reduces the likelihood of discrepancies between the docs and the compiler
280 # itself, which uses f/intrin.def; in fact, many bugs in f/intrin.def have
281 # been found only upon reading the documentation that was automatically
282 # produced from it.
283 $(srcdir)/f/intdoc.texi: f/intdoc.c f/intdoc.in f/ansify.c f/intrin.def f/intrin.h
284         case "$(LANGUAGES)" in \
285           *[fF]77*) touch lang-f77;; \
286           *) rm -f lang-f77;; \
287         esac
288         if [ -f lang-f77 ]; then \
289           $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) \
290            `echo $(srcdir)/f/ansify.c | sed 's,^\./,,'` -o f/ansify; \
291           f/ansify < $(srcdir)/f/intdoc.in > f/intdoc.h0 $(srcdir)/f/intdoc.in; \
292           $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) -I./f \
293            `echo $(srcdir)/f/intdoc.c | sed 's,^\./,,'` -o f/intdoc; \
294           f/intdoc > $(srcdir)/f/intdoc.texi; \
295           rm f/intdoc f/ansify f/intdoc.h0; \
296         fi
297
298 $(srcdir)/f/BUGS: f/bugs0.texi f/bugs.texi
299         cd $(srcdir)/f; $(MAKEINFO) -D BUGSONLY --no-header --no-split \
300           --no-validate -o BUGS bugs0.texi
301
302 $(srcdir)/f/INSTALL: f/install0.texi f/g77install.texi
303         cd $(srcdir)/f; $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
304           --no-validate -o INSTALL install0.texi
305
306 $(srcdir)/f/NEWS: f/news0.texi f/news.texi
307         cd $(srcdir)/f; $(MAKEINFO) -D NEWSONLY --no-header --no-split \
308           --no-validate -o NEWS news0.texi
309
310 f77.rebuilt: f/g77.info $(srcdir)/f/BUGS $(srcdir)/f/INSTALL \
311   $(srcdir)/f/NEWS 
312
313 #\f
314 # Install hooks:
315 # f771 is installed elsewhere as part of $(COMPILERS).
316
317 f77.install-normal:
318
319 # Install the driver program as $(target)-g77
320 # and also as either g77 (if native) or $(tooldir)/bin/g77.
321 f77.install-common:
322         case "$(LANGUAGES)" in \
323           *[fF]77*) touch lang-f77;; \
324           *) rm -f lang-f77;; \
325         esac
326         -if [ -f lang-f77 -a -f f771$(exeext) ] ; then \
327           if [ -f g77-cross$(exeext) ] ; then \
328             rm -f $(bindir)/$(G77_CROSS_NAME)$(exeext); \
329             $(INSTALL_PROGRAM) g77-cross$(exeext) $(bindir)/$(G77_CROSS_NAME)$(exeext); \
330             chmod a+x $(bindir)/$(G77_CROSS_NAME)$(exeext); \
331           else \
332             rm -f $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
333             $(INSTALL_PROGRAM) g77$(exeext) $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
334             chmod a+x $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
335           fi ; \
336         else true; fi
337         @if [ -f f77-install-ok -o -f $(srcdir)/f77-install-ok ]; then \
338           echo ''; \
339           echo 'Warning: egcs no longer installs an f77 command.'; \
340           echo '         You must do so yourself.  For more information,'; \
341           echo '         read "Distributing Binaries" in the egcs g77 docs.'; \
342           echo '         (To turn off this warning, delete the file'; \
343           echo '         f77-install-ok in the source or build directory.)'; \
344           echo ''; \
345         fi
346
347 # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
348 # to do the install.  The sed rule was copied from stmp-int-hdrs.
349 f77.install-info: f77.info
350         case "$(LANGUAGES)" in \
351           *[fF]77*) touch lang-f77;; \
352           *) rm -f lang-f77;; \
353         esac
354         if [ -f lang-f77 -a -f f/g77.info ] ; then \
355           rm -f $(infodir)/g77.info*; \
356           for f in f/g77.info*; do \
357               realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
358               $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
359           done; \
360           chmod a-x $(infodir)/g77.info*; \
361         fi
362         @if [ -f lang-f77 -a -f $(srcdir)/f/g77.info ] ; then \
363           if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
364             echo " install-info --info-dir=$(infodir) $(infodir)/g77.info"; \
365             install-info --info-dir=$(infodir) $(infodir)/g77.info || : ; \
366           else : ; fi; \
367         else : ; fi
368
369 f77.install-man: $(srcdir)/f/g77.1
370         case "$(LANGUAGES)" in \
371           *[fF]77*) touch lang-f77;; \
372           *) rm -f lang-f77;; \
373         esac
374         -if [ -f lang-f77 -a -f f771$(exeext) ] ; then \
375           if [ -f g77-cross$(exeext) ] ; then \
376             rm -f $(mandir)/$(G77_CROSS_NAME)$(manext); \
377             $(INSTALL_DATA) $(srcdir)/f/g77.1 $(mandir)/$(G77_CROSS_NAME)$(manext); \
378             chmod a-x $(mandir)/$(G77_CROSS_NAME)$(manext); \
379           else \
380             rm -f $(mandir)/$(G77_INSTALL_NAME)$(manext); \
381             $(INSTALL_DATA) $(srcdir)/f/g77.1 $(mandir)/$(G77_INSTALL_NAME)$(manext); \
382             chmod a-x $(mandir)/$(G77_INSTALL_NAME)$(manext); \
383           fi; \
384         else true; fi
385
386 f77.uninstall:
387         case "$(LANGUAGES)" in \
388           *[fF]77*) touch lang-f77;; \
389           *) rm -f lang-f77;; \
390         esac
391         @if [ -f lang-f77 ] ; then \
392           if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
393             echo " install-info --delete --info-dir=$(infodir) $(infodir)/g77.info"; \
394             install-info --delete --info-dir=$(infodir) $(infodir)/g77.info || : ; \
395           else : ; fi; \
396         else : ; fi
397         -if [ -f lang-f77 ]; then \
398           rm -rf $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
399           rm -rf $(bindir)/$(G77_CROSS_NAME)$(exeext); \
400           rm -rf $(mandir)/$(G77_INSTALL_NAME)$(manext); \
401           rm -rf $(mandir)/$(G77_CROSS_NAME)$(manext); \
402           rm -rf $(infodir)/g77.info*; \
403         fi
404 #\f
405 # Clean hooks:
406 # A lot of the ancillary files are deleted by the main makefile.
407 # We just have to delete files specific to us.
408
409 f77.mostlyclean:
410         -rm -f f/*$(objext)
411         -rm -f f/fini f/stamp-str f/str-*.h f/str-*.j
412         -rm -f f/intdoc f/ansify f/intdoc.h0
413 f77.clean:
414         -rm -f g77.c g77.o g77spec.o g77version.o
415 f77.distclean:
416         -rm -f lang-f77 f/Makefile
417 f77.extraclean:
418 f77.maintainer-clean:
419         -rm -f f/g77.info* f/g77.*aux f/TAGS f/BUGS f/INSTALL f/NEWS f/intdoc.texi
420 #\f
421 # Stage hooks:
422 # The main makefile has already created stage?/f.
423
424 G77STAGESTUFF = f/*$(objext) f/fini f/stamp-str f/str-*.h f/str-*.j \
425   lang-f77 g77.c g77.o g77spec.o g77version.o
426
427 f77.stage1: stage1-start
428         -if [ -f lang-f77 ]; then \
429           mv -f $(G77STAGESTUFF) stage1/f; \
430         fi
431 f77.stage2: stage2-start
432         -if [ -f lang-f77 ]; then \
433           mv -f $(G77STAGESTUFF) stage2/f; \
434         fi
435 f77.stage3: stage3-start
436         -if [ -f lang-f77 ]; then \
437           mv -f $(G77STAGESTUFF) stage3/f; \
438         fi
439 f77.stage4: stage4-start
440         -if [ -f lang-f77 ]; then \
441           mv -f $(G77STAGESTUFF) stage4/f; \
442         fi
443 #\f
444 # Maintenance hooks:
445
446 # This target creates the files that can be rebuilt, but go in the
447 # distribution anyway.  It then copies the files to the distdir directory.
448 f77.distdir: f77.rebuilt
449         case "$(LANGUAGES)" in \
450           *[fF]77*) touch lang-f77;; \
451           *) rm -f lang-f77;; \
452         esac
453         -if [ -f lang-f77 ]; then \
454           mkdir tmp/f; \
455           cd f; \
456           for file in *[0-9a-zA-Z+]; do \
457             $(LN_S) $$file ../tmp/f; \
458           done; \
459         fi