1 # Makefile for GNU F77 compiler runtime.
2 # Copyright (C) 1995-1998, 2001, 2002 Free Software Foundation, Inc.
3 # Contributed by Dave Love (d.love@dl.ac.uk).
5 #This file is part of GNU Fortran.
7 #GNU Fortran is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 2, or (at your option)
12 #GNU Fortran is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GNU Fortran; see the file COPYING. If not, write to
19 #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 #### Start of system configuration section. ####
29 srcdir = @glibcpp_srcdir@
30 VPATH = @glibcpp_srcdir@
32 exec_prefix = @exec_prefix@
33 target_alias = @target_alias@
34 gcc_version = @gcc_version@
35 gcc_version_trigger = @gcc_version_trigger@
36 top_srcdir = @top_srcdir@
37 toplevel_srcdir = @toplevel_srcdir@
38 toolexecdir = @glibcpp_toolexecdir@
39 glibcpp_toolexecdir = @glibcpp_toolexecdir@
40 glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
44 libdir = $(exec_prefix)/lib
45 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
47 # Versions should start at 0:0:0 - See libtool manual.
52 # Multilib support variables.
60 # Not configured per top-level version, since that doesn't get passed
61 # Versions should start at 0:0:0 - See libtool manual.
62 # down at configure time, but overrridden by the top-level install
65 INSTALL_PROGRAM = @INSTALL_PROGRAM@
66 INSTALL_DATA = @INSTALL_DATA@
74 # List of variables to pass to sub-makes.
75 # Quote this way so that it can be used to set shell variables too.
79 LIBTOOL='$(LIBTOOL)' \
81 CPPFLAGS='$(CPPFLAGS)' \
85 exec_prefix='$(exec_prefix)' \
87 libsubdir='$(libsubdir)' \
91 LIBG2C = $(LIBG2C_BASE).la
93 SUBDIRS = libI77 libF77 libU77
95 F2CEXT = abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc \
96 signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1 \
97 besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn \
98 dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror \
99 getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand \
100 isatty itime kill link lnblnk lstat ltime mclock perror rand rename \
101 secnds second sleep srand stat symlnk time ttynam umask unlink \
103 date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
107 # The logic here is partly dictated by the desire to keep the lib?77
108 # subdirs for compatibility with the Netlib version and because libU77
109 # has a different copyright; then the libe77 bit (EXTERNALly-callable
110 # versions) is funny. Given that, as well as keeping things as simple
111 # as possible we want (at least) the following:
112 # * Allow make to be run at the top level (all-target-libf2c), at this
113 # level, or the subdirs of this level. In the latter case we only
114 # compile, rather than updating libg2c.a;
115 # * A robust set of dependencies, so that we rebuild (as little as
116 # possible) if a configuration file, g2c.h or any lib?77/*.c file
118 # * Avoid unnecessary running of ar and ranlib;
119 # * Expose parallelism where reasonable, but not as a priority.
121 # The intended top-level target here does a non-multilib build (via
122 # the dependency) and then (perhaps) builds multilibs.
125 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="all-unilib"
127 # `all-unilib' is the overall target in the absence of multilibs,
128 # meant to be invoked via multi-do for multilibs.
130 # Its dependencies can be satisfied in parallel. The [fiu]77 targets
131 # update stamp files (object file lists, actually, see the subdir
132 # makefiles) on which the $(LIBG2C) depends. The stamp files
133 # s-lib[fiu]77 are intentionally not targets, since we're only meant
134 # to come in at the level of this target. The [fiu]77 targets always
135 # invoke sub makes to check dependencies in the subdirs, else we'd
136 # have to maintain them at this level; we live with the overhead of
137 # some recursive makes which may do nothing.
139 all-unilib: i77 f77 u77 s-libe77
140 $(MAKE) $(FLAGS_TO_PASS) $(LIBG2C)
144 # This target should normally only get invoked via `all-unilib' --
145 # after all's well in the subdirs -- actually to assemble the library.
146 # The stamp files contain the object lists of each component of the
147 # library. The point of breaking them up is to avoid command-line
148 # length limitations.
150 $(LIBG2C): s-libi77 s-libf77 s-libu77 s-libe77
151 $(LIBTOOL) --mode=link $(CC) -o $@ \
152 -version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
153 -rpath $(libdir)$(MULTISUBDIR) \
154 -objectlist s-libe77 \
155 -objectlist s-libf77 \
156 -objectlist s-libi77 \
157 -objectlist s-libu77 \
161 cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
164 cd libF77; $(MAKE) $(FLAGS_TO_PASS) all
167 cd libU77; $(MAKE) $(FLAGS_TO_PASS) all
170 if [ -d libE77 ]; then rm -f libE77/*.o libE77/*.lo; else mkdir libE77; fi
172 for name in $(F2CEXT); \
175 $(LIBTOOL) --mode=compile $(CC) -c -I. -I$(srcdir) -I../../include \
176 $(CPPFLAGS) $(CFLAGS) -DL$${name} $(srcdir)/f2cext.c \
177 -o libE77/L$${name}.lo ; \
178 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
179 echo libE77/L$${name}.lo >> $@.T; \
185 ${srcdir}/configure: configure.in
187 cd $(srcdir) && autoconf
189 # Dependence on Makefile serializes for parallel make.
190 g2c.h: g2c.hin config.status Makefile
191 # Might try to avoid rebuilding everything if Makefile or configure
192 # changes and g2c.h doesn't; see also the Makefile rule. Should
193 # depend on another stamp file rather than using the commented-out
194 # lines below, since g2c.h isn't necessarily brought up to date.
196 $(SHELL) config.status
197 # $(SHELL) $(srcdir)/../move-if-change g2c.h g2c.x && mv g2c.x g2c.h
199 Makefile: Makefile.in config.status
200 # Autoconf doc uses `./config.status'. Is there a good reason to use $(SHELL)?
201 $(SHELL) config.status
203 config.status: configure $(gcc_version_trigger)
204 # Make sure we don't pick up a site config file and that configure
205 # gets run with correct values of variables such as CC.
206 CONFIG_SITE=no-such-file $(FLAGS_TO_PASS) \
207 $(SHELL) config.status --recheck
209 info install-info clean-info dvi TAGS dist installcheck installdirs:
212 cd libU77; $(MAKE) G77DIR=../../../gcc/ check
215 $(SHELL) $(toplevel_srcdir)/mkinstalldirs $(glibcpp_toolexeclibdir)
216 $(LIBTOOL) --mode=install $(INSTALL) $(LIBG2C) $(glibcpp_toolexeclibdir)
217 $(INSTALL_DATA) libfrtbegin.a $(glibcpp_toolexeclibdir)
218 $(RANLIB) $(glibcpp_toolexeclibdir)/libfrtbegin.a
219 $(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
220 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
221 @-$(LIBTOOL) --mode=finish $(glibcpp_toolexeclibdir)
224 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
227 rm -f $(libsubdir)/include/g2c.h
228 rm -f $(glibcpp_toolexeclibdir)/libfrtbegin.a
229 $(LIBTOOL) --mode=uninstall rm -f $(glibcpp_toolexeclibdir)$(LIBG2C_BASE).la
230 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
233 rm -f $(LIBG2C) objlist
234 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
235 $(MULTICLEAN) multi-clean DO=$@
236 rm -fr libE77 s-libe77
240 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
241 $(MULTICLEAN) multi-clean DO=$@
246 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
247 $(MULTICLEAN) multi-clean DO=distclean
248 rm -f config.cache config.status Makefile
254 .PHONY: rebuilt mostlyclean clean distclean maintainer-clean all \
255 i77 f77 u77 check uninstall install-strip dist \
256 installcheck installdirs all-unilib
259 @rootpre=`${PWD}`/; export rootpre; \
260 srcrootpre=`cd $(srcdir); ${PWD}`/; export srcrootpre; \
261 for i in .. $(DODIRS); do \
262 if [ x$$i != x.. ]; then \
263 if [ -f ./$$i/Makefile ]; then \
264 if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \
273 # multidoings may be added here by configure.