1 # Top level makefile fragment for GNU Fortran. -*-makefile-*-
2 # Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
4 #This file is part of GNU Fortran.
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)
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.
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.
21 # This file provides the language dependent support in the main Makefile.
22 # Each language makefile fragment must provide the following targets:
24 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
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
31 # where `foo' is the name of the language.
33 # It should also provide rules for:
35 # - making any compiler driver (eg: g++)
36 # - the compiler proper (eg: cc1plus)
37 # - define the names for selecting the language in LANGUAGES.
39 # $(srcdir) must be set to the gcc/ source directory (not gcc/f/).
41 # Actual name to use when installing a native compiler.
42 G77_INSTALL_NAME = `t='$(program_transform_name)'; echo g77 | sed $$t`
44 # Actual name to use when installing a cross-compiler.
45 G77_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g77 | sed $$t`
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)
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 \
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
62 g77spec.o: $(srcdir)/f/g77spec.c $(srcdir)/f/version.h system.h $(GCC_H)
63 case "$(LANGUAGES)" in \
64 *[fF]77*) touch lang-f77;; \
67 if [ -f lang-f77 ]; then \
68 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/f/g77spec.c; \
71 g77version.o: $(srcdir)/f/version.c
72 case "$(LANGUAGES)" in \
73 *[fF]77*) touch lang-f77;; \
76 if [ -f lang-f77 ]; then \
77 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -o g77version.o \
78 $(srcdir)/f/version.c; \
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); \
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); \
102 $(srcdir)/f/bld-op.def \
105 $(srcdir)/f/com-rt.def \
110 $(srcdir)/f/equiv.c \
111 $(srcdir)/f/equiv.h \
115 $(srcdir)/f/global.c \
116 $(srcdir)/f/global.h \
117 $(srcdir)/f/implic.c \
118 $(srcdir)/f/implic.h \
119 $(srcdir)/f/info-b.def \
120 $(srcdir)/f/info-k.def \
121 $(srcdir)/f/info-w.def \
124 $(srcdir)/f/intrin.c \
125 $(srcdir)/f/intrin.def \
126 $(srcdir)/f/intrin.h \
131 $(srcdir)/f/malloc.c \
132 $(srcdir)/f/malloc.h \
135 $(srcdir)/f/parse.c \
152 $(srcdir)/f/storag.c \
153 $(srcdir)/f/storag.h \
156 $(srcdir)/f/str-1t.fin \
157 $(srcdir)/f/str-2t.fin \
158 $(srcdir)/f/str-fo.fin \
159 $(srcdir)/f/str-io.fin \
160 $(srcdir)/f/str-nq.fin \
161 $(srcdir)/f/str-op.fin \
162 $(srcdir)/f/str-ot.fin \
175 $(srcdir)/f/symbol.c \
176 $(srcdir)/f/symbol.def \
177 $(srcdir)/f/symbol.h \
178 $(srcdir)/f/target.c \
179 $(srcdir)/f/target.h \
184 $(srcdir)/f/version.c \
185 $(srcdir)/f/version.h \
186 $(srcdir)/f/where.c \
189 f771$(exeext): $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist
191 cd f; $(MAKE) $(LANG_FLAGS_TO_PASS) \
192 HOST_CC="`case '$(HOST_CC)' in stage*) echo '$(HOST_CC)' | sed -e 's|stage|../stage|g';; *) echo '$(HOST_CC)';; esac`" \
193 HOST_CFLAGS="$(HOST_CFLAGS)" HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \
199 f77.all.build: g77$(exeext)
200 f77.all.cross: g77-cross$(exeext)
201 f77.start.encap: g77$(exeext)
208 f/g77.info: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
209 $(srcdir)/f/ffe.texi \
210 $(srcdir)/f/g77install.texi $(srcdir)/f/news.texi \
211 $(srcdir)/f/intdoc.texi $(srcdir)/f/root.texi
212 case "$(LANGUAGES)" in \
213 *[fF]77*) touch lang-f77;; \
214 *) rm -f lang-f77;; \
216 if [ -f lang-f77 ]; then \
217 rm -f $(srcdir)/f/g77.info-*; \
218 $(MAKEINFO) -I$(srcdir)/f -o f/g77.info $(srcdir)/f/g77.texi; \
221 f/g77.dvi: $(srcdir)/f/g77.texi $(srcdir)/f/bugs.texi \
222 $(srcdir)/f/ffe.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;; \
229 # `tex2dvi' was used below, but the Texinfo 3.12 one won't work properly
230 # with the include files from $(srcdir). This use of TEXINPUTS may not
231 # be universally valid. `$(TEX)' should be used if it gets defined in
233 if [ -f lang-f77 ]; then \
234 TEXINPUTS=$(srcdir)/f:$$TEXINPUTS tex $(srcdir)/f/g77.texi; \
236 TEXINPUTS=$(srcdir)/f:$$TEXINPUTS tex $(srcdir)/f/g77.texi; \
240 # This dance is all about producing accurate documentation for g77's
241 # intrinsics with minimum fuss. f/ansify appends "\n\" to C strings
242 # so ANSI C compilers can compile f/intdoc.h -- gcc can compile f/intdoc.in
243 # directly, if f/intdoc.c #include'd that, but we don't want to force
244 # people to install gcc just to build the documentation. We use the
245 # C format for f/intdoc.in in the first place to allow a fairly "free",
246 # but widely known format for documentation -- basically anyone who knows
247 # how to write texinfo source and enclose it in C constants can handle
248 # it, and f/ansify allows them to not even end lines with "\n\". So,
249 # essentially, the C preprocessor and compiler are used to enter the
250 # document snippets into a data base via name lookup, rather than duplicating
251 # that kind of code here. And we use f/intdoc.c instead of straight
252 # texinfo in the first place so that as much information as possible
253 # contained in f/intrin.def can be inserted directly and reliably into
254 # the documentation. That's better than replicating it, because it
255 # reduces the likelihood of discrepancies between the docs and the compiler
256 # itself, which uses f/intrin.def; in fact, many bugs in f/intrin.def have
257 # been found only upon reading the documentation that was automatically
259 $(srcdir)/f/intdoc.texi: f/intdoc.c f/intdoc.in f/ansify.c f/intrin.def f/intrin.h
260 case "$(LANGUAGES)" in \
261 *[fF]77*) touch lang-f77;; \
262 *) rm -f lang-f77;; \
264 if [ -f lang-f77 ]; then \
265 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) \
266 `echo $(srcdir)/f/ansify.c | sed 's,^\./,,'` -o f/ansify; \
267 f/ansify < $(srcdir)/f/intdoc.in > f/intdoc.h0 $(srcdir)/f/intdoc.in; \
268 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(INCLUDES) -I./f \
269 `echo $(srcdir)/f/intdoc.c | sed 's,^\./,,'` -o f/intdoc; \
270 f/intdoc > $(srcdir)/f/intdoc.texi; \
271 rm f/intdoc f/ansify f/intdoc.h0; \
274 $(srcdir)/f/BUGS: f/bugs0.texi f/bugs.texi f/root.texi
275 cd $(srcdir)/f; $(MAKEINFO) -D BUGSONLY --no-header --no-split \
276 --no-validate -o BUGS bugs0.texi
278 $(srcdir)/f/INSTALL: f/install0.texi f/g77install.texi f/root.texi
279 cd $(srcdir)/f; $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
280 --no-validate -o INSTALL install0.texi
282 $(srcdir)/f/NEWS: f/news0.texi f/news.texi f/root.texi
283 cd $(srcdir)/f; $(MAKEINFO) -D NEWSONLY --no-header --no-split \
284 --no-validate -o NEWS news0.texi
286 f77.rebuilt: f/g77.info $(srcdir)/f/BUGS $(srcdir)/f/INSTALL \
291 # f771 is installed elsewhere as part of $(COMPILERS).
295 # Install the driver program as $(target)-g77
296 # and also as either g77 (if native) or $(tooldir)/bin/g77.
297 # Make sure `installdirs' target (from gcc Makefile) has been
298 # run, since we use libsubdir to store our `flag' file, lang-f77.
299 f77.install-common: installdirs
300 case "$(LANGUAGES)" in \
301 *[fF]77*) touch $(libsubdir)/lang-f77.com;; \
302 *) rm -f $(libsubdir)/lang-f77.com;; \
304 -if [ -f $(libsubdir)/lang-f77.com -a -f f771$(exeext) ] ; then \
305 if [ -f g77-cross$(exeext) ] ; then \
306 rm -f $(bindir)/$(G77_CROSS_NAME)$(exeext); \
307 $(INSTALL_PROGRAM) g77-cross$(exeext) $(bindir)/$(G77_CROSS_NAME)$(exeext); \
308 chmod a+x $(bindir)/$(G77_CROSS_NAME)$(exeext); \
310 rm -f $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
311 $(INSTALL_PROGRAM) g77$(exeext) $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
312 chmod a+x $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
315 @if [ -f f77-install-ok -o -f $(srcdir)/f77-install-ok ]; then \
317 echo 'Warning: gcc no longer installs an f77 command.'; \
318 echo ' You must do so yourself. For more information,'; \
319 echo ' read "Distributing Binaries" in the egcs g77 docs.'; \
320 echo ' (To turn off this warning, delete the file'; \
321 echo ' f77-install-ok in the source or build directory.)'; \
324 rm -f $(libsubdir)/lang-f77.com
326 # $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
327 # to do the install. The sed rule was copied from stmp-int-hdrs.
328 # Make sure `installdirs' target (from gcc Makefile) has been
329 # run, since we use libsubdir to store our `flag' file, lang-f77.
330 f77.install-info: f77.info installdirs
331 case "$(LANGUAGES)" in \
332 *[fF]77*) touch $(libsubdir)/lang-f77.info;; \
333 *) rm -f $(libsubdir)/lang-f77.info;; \
335 if [ -f $(libsubdir)/lang-f77.info -a -f f/g77.info ] ; then \
336 rm -f $(infodir)/g77.info*; \
337 for f in f/g77.info*; do \
338 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
339 $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
341 chmod a-x $(infodir)/g77.info*; \
343 @if [ -f $(libsubdir)/lang-f77.info -a -f $(srcdir)/f/g77.info ] ; then \
344 if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
345 echo " install-info --info-dir=$(infodir) $(infodir)/g77.info"; \
346 install-info --info-dir=$(infodir) $(infodir)/g77.info || : ; \
349 rm -f $(libsubdir)/lang-f77.info
351 # Make sure `installdirs' target (from gcc Makefile) has been
352 # run, since we use libsubdir to store our `flag' file, lang-f77.
353 f77.install-man: $(srcdir)/f/g77.1 installdirs
354 case "$(LANGUAGES)" in \
355 *[fF]77*) touch $(libsubdir)/lang-f77.man;; \
356 *) rm -f $(libsubdir)/lang-f77.man;; \
358 -if [ -f $(libsubdir)/lang-f77.man -a -f f771$(exeext) ] ; then \
359 if [ -f g77-cross$(exeext) ] ; then \
360 rm -f $(man1dir)/$(G77_CROSS_NAME)$(manext); \
361 $(INSTALL_DATA) $(srcdir)/f/g77.1 $(man1dir)/$(G77_CROSS_NAME)$(manext); \
362 chmod a-x $(man1dir)/$(G77_CROSS_NAME)$(manext); \
364 rm -f $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
365 $(INSTALL_DATA) $(srcdir)/f/g77.1 $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
366 chmod a-x $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
369 rm -f $(libsubdir)/lang-f77.man
371 # Make sure `installdirs' target (from gcc Makefile) has been
372 # run, since we use libsubdir to store our `flag' file, lang-f77.
373 f77.uninstall: installdirs
374 case "$(LANGUAGES)" in \
375 *[fF]77*) touch $(libsubdir)/lang-f77.un;; \
376 *) rm -f $(libsubdir)/lang-f77.un;; \
378 @if [ -f $(libsubdir)/lang-f77.un ] ; then \
379 if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
380 echo " install-info --delete --info-dir=$(infodir) $(infodir)/g77.info"; \
381 install-info --delete --info-dir=$(infodir) $(infodir)/g77.info || : ; \
384 -if [ -f $(libsubdir)/lang-f77.un ]; then \
385 rm -rf $(bindir)/$(G77_INSTALL_NAME)$(exeext); \
386 rm -rf $(bindir)/$(G77_CROSS_NAME)$(exeext); \
387 rm -rf $(man1dir)/$(G77_INSTALL_NAME)$(manext); \
388 rm -rf $(man1dir)/$(G77_CROSS_NAME)$(manext); \
389 rm -rf $(infodir)/g77.info*; \
391 rm -f $(libsubdir)/lang-f77.un
394 # A lot of the ancillary files are deleted by the main makefile.
395 # We just have to delete files specific to us.
399 -rm -f f/fini f/stamp-str f/str-*.h f/str-*.j
400 -rm -f f/intdoc f/ansify f/intdoc.h0
401 -rm -f g77.aux g77.cps g77.ky g77.toc g77.vr g77.fn g77.kys \
402 g77.pg g77.tp g77.vrs g77.cp g77.fns g77.log g77.pgs g77.tps
404 -rm -f g77spec.o g77version.o
406 -rm -f lang-f77 f/Makefile
408 f77.maintainer-clean:
409 -rm -f f/g77.info* f/g77.*aux f/TAGS f/BUGS f/INSTALL f/NEWS f/intdoc.texi
412 # The main makefile has already created stage?/f.
414 G77STAGESTUFF = f/*$(objext) f/fini f/stamp-str f/str-*.h f/str-*.j \
415 lang-f77 g77spec.o g77version.o
417 f77.stage1: stage1-start
418 -if [ -f lang-f77 ]; then \
419 mv -f $(G77STAGESTUFF) stage1/f; \
421 f77.stage2: stage2-start
422 -if [ -f lang-f77 ]; then \
423 mv -f $(G77STAGESTUFF) stage2/f; \
425 f77.stage3: stage3-start
426 -if [ -f lang-f77 ]; then \
427 mv -f $(G77STAGESTUFF) stage3/f; \
429 f77.stage4: stage4-start
430 -if [ -f lang-f77 ]; then \
431 mv -f $(G77STAGESTUFF) stage4/f; \
436 # This target creates the files that can be rebuilt, but go in the
437 # distribution anyway. It then copies the files to the distdir directory.
438 f77.distdir: f77.rebuilt
439 case "$(LANGUAGES)" in \
440 *[fF]77*) touch lang-f77;; \
441 *) rm -f lang-f77;; \
443 -if [ -f lang-f77 ]; then \
446 for file in *[0-9a-zA-Z+]; do \
447 $(LN_S) $$file ../tmp/f; \