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