1 # Top level makefile fragment for GNU Fortran. -*-makefile-*-
2 # Copyright (C) 1995-1997 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, Boston, MA
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: g77)
36 # - the compiler proper (eg: f771)
37 # - define the names for selecting the language in LANGUAGES.
39 # $(srcdir) must be set to the gcc/ source directory (not gcc/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.
47 AR_FLAGS="$(AR_FLAGS)" \
50 BISONFLAGS="$(BISONFLAGS)" \
53 X_CFLAGS="$(X_CFLAGS)" \
54 LDFLAGS="$(LDFLAGS)" \
56 LEXFLAGS="$(LEXFLAGS)" \
57 MAKEINFO="$(MAKEINFO)" \
58 MAKEINFOFLAGS="$(MAKEINFOFLAGS)" \
60 RANLIB_TEST="$(RANLIB_TEST)" \
62 exec_prefix="$(exec_prefix)" \
64 tooldir="$(tooldir)" \
66 libsubdir="$(libsubdir)"
67 # "F77_FOR_BUILD=$(F77_FOR_BUILD)" \
68 # "F77FLAGS=$(F77FLAGS)" \
69 # "F77_FOR_TARGET=$(F77_FOR_TARGET)"
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 ]
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`
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`
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.
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
101 g77.c: $(srcdir)/gcc.c
103 $(LN_S) $(srcdir)/gcc.c $@
105 g77spec.o: $(srcdir)/f/g77spec.c
106 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/f/g77spec.c
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) \
115 -DLANG_SPECIFIC_DRIVER -c g77.c
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)
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)
128 $(srcdir)/f/assert.j \
130 $(srcdir)/f/bad.def \
134 $(srcdir)/f/bld-op.def \
137 $(srcdir)/f/com-rt.def \
140 $(srcdir)/f/config.j \
141 $(srcdir)/f/convert.j \
144 $(srcdir)/f/equiv.c \
145 $(srcdir)/f/equiv.h \
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 \
162 $(srcdir)/f/intrin.c \
163 $(srcdir)/f/intrin.def \
164 $(srcdir)/f/intrin.h \
169 $(srcdir)/f/malloc.c \
170 $(srcdir)/f/malloc.h \
173 $(srcdir)/f/parse.c \
191 $(srcdir)/f/storag.c \
192 $(srcdir)/f/storag.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 \
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 \
226 $(srcdir)/f/version.c \
227 $(srcdir)/f/version.h \
228 $(srcdir)/f/where.c \
231 f771: $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist f/Makefile
232 $(MAKE) -f f/Makefile $(FLAGS_TO_PASS) VPATH=$(srcdir) srcdir=$(srcdir) f771
234 f/Makefile: $(srcdir)/f/Makefile.in $(srcdir)/configure
235 $(SHELL) config.status
240 f77.all.build: g77$(exeext)
241 f77.all.cross: g77-cross$(exeext)
242 f77.start.encap: g77$(exeext)
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
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
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
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
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
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
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
299 f77.rebuilt: $(srcdir)/f/g77.info $(srcdir)/f/BUGS $(srcdir)/f/INSTALL \
304 # f771 is installed elsewhere as part of $(COMPILERS).
306 f77.install-normal: install-libf77
308 # Install the driver program as $(target)-g77
309 # and also as either g77 (if native) or $(tooldir)/bin/g77.
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); \
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); \
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; \
339 -chmod a-x $(infodir)/g77.info*
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); \
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); \
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) ; \
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*
376 # A lot of the ancillary files are deleted by the main makefile.
377 # We just have to delete files specific to us.
381 -rm -f f/fini f/f771 f/stamp-str f/str-*.h f/str-*.j f/intdoc f/ansify f/intdoc.h0
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
391 # The main makefile has already created stage?/f.
393 G77STAGESTUFF = f/*$(objext) f/fini f/stamp-str f/str-*.h f/str-*.j
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
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
411 for file in *[0-9a-zA-Z+]; do \
412 ($LN) $$file ../tmp/f