X
[official-gcc.git] / libf2c / Makefile.in
blob7c8d880ea2097745943f84262893d514d0197588
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)
10 #any later version.
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
20 #02111-1307, USA.
22 SHELL = /bin/sh
24 #### Start of system configuration section. ####
26 srcdir = @srcdir@
27 VPATH = @srcdir@
28 prefix = @prefix@
29 exec_prefix = @exec_prefix@
30 target_alias = @target_alias@
31 gcc_version = @gcc_version@
32 gcc_version_trigger = @gcc_version_trigger@
34 libdir = $(exec_prefix)/lib
35 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
37 # Multilib support variables.
38 MULTISRCTOP =
39 MULTIBUILDTOP =
40 MULTIDIRS =
41 MULTISUBDIR =
42 MULTIDO = true
43 MULTICLEAN = true
45 # Not configured per top-level version, since that doesn't get passed
46 # down at configure time, but overrridden by the top-level install
47 # target.
48 INSTALL = @INSTALL@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 INSTALL_DATA = @INSTALL_DATA@
52 AR = @AR@
53 AR_FLAGS = rc
55 RANLIB = @RANLIB@
57 CC = @CC@
58 CFLAGS = @CFLAGS@
60 # List of variables to pass to sub-makes.
61 # Quote this way so that it can be used to set shell variables too.
62 # Currently no use for PICFLAG, RUNTESTFLAGS -- check usage.
63 FLAGS_TO_PASS= \
64 CC='$(CC)' \
65 CFLAGS='$(CFLAGS)' \
66 CPPFLAGS='$(CPPFLAGS)' \
67 AR='$(AR)' \
68 RANLIB='$(RANLIB)' \
69 PICFLAG='$(PICFLAG)' \
70 RUNTESTFLAGS='$(RUNTESTFLAGS)'
72 LIBG2C = libg2c.a
74 SUBDIRS = libI77 libF77 libU77
76 F2CEXT = abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc \
77 signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1 \
78 besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn \
79 dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror \
80 getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand \
81 isatty itime kill link lnblnk lstat ltime mclock perror rand rename \
82 secnds second sleep srand stat symlnk time ttynam umask unlink \
83 vxttim alarm \
84 date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
86 .SUFFIXES:
88 # The logic here is partly dictated by the desire to keep the lib?77
89 # subdirs for compatibility with the Netlib version and because libU77
90 # has a different copyright; then the libe77 bit (EXTERNALly-callable
91 # versions) is funny. Given that, as well as keeping things as simple
92 # as possible we want (at least) the following:
93 # * Allow make to be run at the top level (all-target-libf2c), at this
94 # level, or the subdirs of this level. In the latter case we only
95 # compile, rather than updating libg2c.a;
96 # * A robust set of dependencies, so that we rebuild (as little as
97 # possible) if a configuration file, g2c.h or any lib?77/*.c file
98 # changes;
99 # * Avoid unnecessary running of ar and ranlib;
100 # * Expose parallelism where reasonable, but not as a priority.
102 # The intended top-level target here does a non-multilib build (via
103 # the dependency) and then (perhaps) builds multilibs.
105 all: all-unilib
106 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="all-unilib"
108 # `all-unilib' is the overall target in the absence of multilibs,
109 # meant to be invoked via multi-do for multilibs.
111 # Its dependencies can be satisfied in parallel. The [fiu]77 targets
112 # update stamp files (see the subdir makefiles) which the $(LIBG2C)
113 # target checks in the sub make to decide whether to run ar/ranlib.
114 # (Probably only one stamp file is really needed.) The stamp files
115 # s-lib[fiu]77 are intentionally not targets, since we're only meant
116 # to come in at the level of this target. The [fiu]77 targets always
117 # invoke sub makes to check dependencies in the subdirs, else we'd
118 # have to maintain them at this level; we live with the overhead of
119 # some recursive makes which may do nothing.
121 all-unilib: i77 f77 u77 s-libe77
122 $(MAKE) $(FLAGS_TO_PASS) $(LIBG2C)
124 i77 f77 u77: g2c.h
126 # This target should normally only get invoked via `all-unilib' --
127 # after all's well in the subdirs -- actually to assemble the library.
128 # The stamp file dependencies are just to check whether libg2c.a is
129 # up-to-date (to avoid running ar regardless) -- the files should
130 # always have been created by a successful `all-unilib'.
132 $(LIBG2C): s-libi77 s-libf77 s-libu77 s-libe77
133 rm -f $(LIBG2C)
134 set -e; \
135 for i in $(SUBDIRS); \
136 do (cd $$i && $(MAKE) $(FLAGS_TO_PASS) LIBG2C=../$(LIBG2C) archive); \
137 done
138 objs=""; for i in $(F2CEXT); do objs="$$objs libE77/L$$i.o"; done; \
139 $(AR) $(AR_FLAGS) $(LIBG2C) $$objs
140 $(RANLIB) $(LIBG2C)
142 i77:
143 cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
145 f77:
146 cd libF77; $(MAKE) $(FLAGS_TO_PASS) all
148 u77:
149 cd libU77; $(MAKE) $(FLAGS_TO_PASS) all
151 s-libe77: f2cext.c
152 if [ -d libE77 ]; then rm -f libE77/*.o; else mkdir libE77; fi
153 for name in $(F2CEXT); \
154 do \
155 echo $${name}; \
156 $(CC) -c -I. -I$(srcdir) -I../../include $(CPPFLAGS) $(CFLAGS) \
157 -DL$${name} $(srcdir)/f2cext.c \
158 -o libE77/L$${name}.o; \
159 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
160 done
161 echo timestamp >s-libe77
163 f2cext.c: g2c.h
165 ${srcdir}/configure: configure.in
166 rm -f config.cache
167 cd $(srcdir) && autoconf
169 # Dependence on Makefile serializes for parallel make.
170 g2c.h: g2c.hin config.status Makefile
171 # Might try to avoid rebuilding everything if Makefile or configure
172 # changes and g2c.h doesn't; see also the Makefile rule. Should
173 # depend on another stamp file rather than using the commented-out
174 # lines below, since g2c.h isn't necessarily brought up to date.
175 # mv g2c.h g2c.x
176 $(SHELL) config.status
177 # $(srcdir)/../move-if-change g2c.h g2c.x && mv g2c.x g2c.h
179 Makefile: Makefile.in config.status
180 # Autoconf doc uses `./config.status'. Is there a good reason to use $(SHELL)?
181 $(SHELL) config.status
183 config.status: configure $(gcc_version_trigger)
184 # Make sure we don't pick up a site config file and that configure
185 # gets run with correct values of variables such as CC.
186 CONFIG_SITE=no-such-file $(FLAGS_TO_PASS) \
187 $(SHELL) config.status --recheck
189 info install-info clean-info dvi TAGS dist installcheck installdirs:
191 check:
192 cd libU77; $(MAKE) G77DIR=../../../gcc/ check
194 install: all
195 $(INSTALL_DATA) $(LIBG2C) $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n
196 ( cd $(libsubdir)/$(MULTISUBDIR) ; $(RANLIB) $(LIBG2C).n )
197 mv -f $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C).n $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
198 $(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
199 @if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
200 echo ''; \
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.)'; \
206 echo ''; \
207 else true; fi
208 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
210 install-strip:
211 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
213 uninstall:
214 rm -f $(libsubdir)/$(MULTISUBDIR)/include/g2c.h $(libsubdir)/$(MULTISUBDIR)/$(LIBG2C)
215 $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
217 mostlyclean:
218 rm -f $(LIBG2C)
219 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
220 $(MULTICLEAN) multi-clean DO=$@
221 rm -fr libE77 s-libe77
223 clean: mostlyclean
224 rm -f config.log
225 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
226 $(MULTICLEAN) multi-clean DO=$@
228 distclean: clean
229 rm -f g2c.h s-libe77
230 $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
231 $(MULTICLEAN) multi-clean DO=distclean
232 rm -f config.cache config.status Makefile
234 maintainer-clean:
236 rebuilt: configure
238 .PHONY: rebuilt mostlyclean clean distclean maintainer-clean all \
239 i77 f77 u77 check uninstall install-strip dist \
240 installcheck installdirs all-unilib
242 subdir_do:
243 @rootpre=`pwd`/; export rootpre; \
244 srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
245 for i in .. $(DODIRS); do \
246 if [ x$$i != x.. ]; then \
247 if [ -f ./$$i/Makefile ]; then \
248 if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \
249 true; \
250 else \
251 exit 1; \
252 fi; \
253 else true; fi; \
254 else true; fi; \
255 done
257 # multidoings may be added here by configure.