1 # Makefile for GNU F77 compiler runtime.
2 # Copyright (C) 1995-1998 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
24 #### Start of system configuration section. ####
29 exec_prefix = @exec_prefix@
30 target_alias = @target_alias@
31 gcc_version = @gcc_version@
32 gcc_version_trigger = @gcc_version_trigger@
36 libdir = $(exec_prefix)/lib
37 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
39 # Versions should start at 0:0:0 - See libtool manual.
44 # Multilib support variables.
52 # Not configured per top-level version, since that doesn't get passed
53 # Versions should start at 0:0:0 - See libtool manual.
54 # down at configure time, but overrridden by the top-level install
57 INSTALL_PROGRAM = @INSTALL_PROGRAM@
58 INSTALL_DATA = @INSTALL_DATA@
64 # List of variables to pass to sub-makes.
65 # Quote this way so that it can be used to set shell variables too.
68 LIBTOOL='$(LIBTOOL)' \
70 CPPFLAGS='$(CPPFLAGS)' \
74 exec_prefix='$(exec_prefix)' \
76 libsubdir='$(libsubdir)' \
80 LIBG2C = $(LIBG2C_BASE).la
82 SUBDIRS = libI77 libF77 libU77
84 F2CEXT = abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc \
85 signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1 \
86 besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn \
87 dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror \
88 getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand \
89 isatty itime kill link lnblnk lstat ltime mclock perror rand rename \
90 secnds second sleep srand stat symlnk time ttynam umask unlink \
92 date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
96 # The logic here is partly dictated by the desire to keep the lib?77
97 # subdirs for compatibility with the Netlib version and because libU77
98 # has a different copyright; then the libe77 bit (EXTERNALly-callable
99 # versions) is funny. Given that, as well as keeping things as simple
100 # as possible we want (at least) the following:
101 # * Allow make to be run at the top level (all-target-libf2c), at this
102 # level, or the subdirs of this level. In the latter case we only
103 # compile, rather than updating libg2c.a;
104 # * A robust set of dependencies, so that we rebuild (as little as
105 # possible) if a configuration file, g2c.h or any lib?77/*.c file
107 # * Avoid unnecessary running of ar and ranlib;
108 # * Expose parallelism where reasonable, but not as a priority.
110 # The intended top-level target here does a non-multilib build (via
111 # the dependency) and then (perhaps) builds multilibs.
114 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="all-unilib"
116 # `all-unilib' is the overall target in the absence of multilibs,
117 # meant to be invoked via multi-do for multilibs.
119 # Its dependencies can be satisfied in parallel. The [fiu]77 targets
120 # always invoke sub makes to check dependencies in the subdirs, else we'd
121 # have to maintain them at this level; we live with the overhead of
122 # some recursive makes which may do nothing.
124 all-unilib: i77 f77 u77 libE77.la
125 $(MAKE) $(FLAGS_TO_PASS) $(LIBG2C)
129 # This target should normally only get invoked via `all-unilib' --
130 # after all's well in the subdirs -- actually to assemble the library.
132 $(LIBG2C): libF77.la libI77.la libU77.la libE77.la
135 $(LIBTOOL) --mode=link $(CC) -o $@ \
136 -version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
137 -rpath $(prefix)/lib libE77.la libF77.la libI77.la libU77.la -lc -lm
140 cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
143 cd libF77; $(MAKE) $(FLAGS_TO_PASS) all
146 cd libU77; $(MAKE) $(FLAGS_TO_PASS) all
150 if [ -d libE77 ]; then rm -f libE77/*.o libE77/*.lo; else mkdir libE77; fi
151 for name in $(F2CEXT); \
154 $(LIBTOOL) --mode=compile $(CC) -c -I. -I$(srcdir) -I../../include \
155 $(CPPFLAGS) $(CFLAGS) -DL$${name} $(srcdir)/f2cext.c \
156 -o libE77/L$${name}.o ; \
157 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
159 $(LIBTOOL) --mode=link $(CC) -o libE77.la libE77/*.lo
163 ${srcdir}/configure: configure.in
165 cd $(srcdir) && autoconf
167 # Dependence on Makefile serializes for parallel make.
168 g2c.h: g2c.hin config.status Makefile
169 # Might try to avoid rebuilding everything if Makefile or configure
170 # changes and g2c.h doesn't; see also the Makefile rule. Should
171 # depend on another stamp file rather than using the commented-out
172 # lines below, since g2c.h isn't necessarily brought up to date.
174 $(SHELL) config.status
175 # $(SHELL) $(srcdir)/../move-if-change g2c.h g2c.x && mv g2c.x g2c.h
177 Makefile: Makefile.in config.status
178 # Autoconf doc uses `./config.status'. Is there a good reason to use $(SHELL)?
179 $(SHELL) config.status
181 config.status: configure $(gcc_version_trigger)
182 # Make sure we don't pick up a site config file and that configure
183 # gets run with correct values of variables such as CC.
184 CONFIG_SITE=no-such-file $(FLAGS_TO_PASS) \
185 $(SHELL) config.status --recheck
187 info install-info clean-info dvi TAGS dist installcheck installdirs:
190 cd libU77; $(MAKE) G77DIR=../../../gcc/ check
193 $(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIBG2C) $(libsubdir)/$(MULTISUBDIR)
194 (cd $(libsubdir)/$(MULTISUBDIR) ; mv -f $(LIBG2C_BASE).* $(prefix)/lib)
195 $(INSTALL_DATA) libfrtbegin.a $(libsubdir)/$(MULTISUBDIR)
196 $(RANLIB) $(libsubdir)/$(MULTISUBDIR)/libfrtbegin.a
197 $(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
198 @if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
200 echo 'Warning: g77 no longer installs libf2c.a or f2c.h.'; \
201 echo ' You must do so yourself. For more information,'; \
202 echo ' read "Distributing Binaries" in the g77 docs.'; \
203 echo ' (To turn off this warning, delete the file'; \
204 echo ' f2c-install-ok in the source or build directory.)'; \
207 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
208 @-$(LIBTOOL) --mode=finish $(prefix)/lib
211 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
214 rm -f $(libsubdir)/$(MULTISUBDIR)/include/g2c.h $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C_BASE).*
215 rm -f $(prefix)/lib/$(LIBG2C_BASE).so*
216 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
219 rm -f $(LIBG2C) objlist
220 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
221 $(MULTICLEAN) multi-clean DO=$@
222 rm -fr libE77 libE77.la
226 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
227 $(MULTICLEAN) multi-clean DO=$@
231 rm -f g2c.h libE77.la
232 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
233 $(MULTICLEAN) multi-clean DO=distclean
234 rm -f config.cache config.status Makefile
240 .PHONY: rebuilt mostlyclean clean distclean maintainer-clean all \
241 i77 f77 u77 check uninstall install-strip dist \
242 installcheck installdirs all-unilib
245 @rootpre=`pwd`/; export rootpre; \
246 srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
247 for i in .. $(DODIRS); do \
248 if [ x$$i != x.. ]; then \
249 if [ -f ./$$i/Makefile ]; then \
250 if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \
259 # multidoings may be added here by configure.