OSDN Git Service

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