OSDN Git Service

2002-01-18 Toon Moene <toon@moene.indiv.nluug.nl>
[pf3gnuchains/gcc-fork.git] / libf2c / Makefile.in
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).
4 #
5 #This file is part of GNU Fortran.
6 #
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.
11 #
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.
16 #
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.
21
22 SHELL = /bin/sh
23 MAKEOVERRIDES=
24
25 #### Start of system configuration section. ####
26
27 srcdir = @srcdir@
28 VPATH = @srcdir@
29 prefix = @prefix@
30 exec_prefix = @exec_prefix@
31 target_alias = @target_alias@
32 gcc_version = @gcc_version@
33 gcc_version_trigger = @gcc_version_trigger@
34
35 top_builddir = .
36
37 libdir = $(exec_prefix)/lib
38 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
39 #
40 # Versions should start at 0:0:0 - See libtool manual.
41 VERSION_MAJOR=0
42 VERSION_MINOR=0
43 VERSION_SUB=0
44
45 # Multilib support variables.
46 MULTISRCTOP =
47 MULTIBUILDTOP =
48 MULTIDIRS =
49 MULTISUBDIR =
50 MULTIDO = true
51 MULTICLEAN = true
52
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
56 # target.
57 INSTALL = @INSTALL@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 INSTALL_DATA = @INSTALL_DATA@
60
61 LIBTOOL = @LIBTOOL@
62 CC = @CC@
63 CFLAGS = @CFLAGS@
64 AR = @AR@
65 RANLIB = @RANLIB@
66
67 # List of variables to pass to sub-makes.
68 # Quote this way so that it can be used to set shell variables too.
69 FLAGS_TO_PASS= \
70         CC='$(CC)' \
71         LIBTOOL='$(LIBTOOL)' \
72         CFLAGS='$(CFLAGS)' \
73         CPPFLAGS='$(CPPFLAGS)' \
74         AR='$(AR)' \
75         RANLIB='$(RANLIB)' \
76         prefix='$(prefix)' \
77         exec_prefix='$(exec_prefix)' \
78         libdir='$(libdir)' \
79         libsubdir='$(libsubdir)' \
80         tooldir='$(tooldir)'
81
82 LIBG2C_BASE = libg2c
83 LIBG2C = $(LIBG2C_BASE).la
84
85 SUBDIRS = libI77 libF77 libU77
86
87 F2CEXT = abort derf derfc ef1asc ef1cmc erf erfc exit getarg getenv iargc \
88         signal system flush ftell fseek access besj0 besj1 besjn besy0 besy1 \
89         besyn chdir chmod ctime dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn \
90         dtime etime fdate fgetc fget flush1 fnum fputc fput fstat gerror \
91         getcwd getgid getlog getpid getuid gmtime hostnm idate ierrno irand \
92         isatty itime kill link lnblnk lstat ltime mclock perror rand rename \
93         secnds second sleep srand stat symlnk time ttynam umask unlink \
94         vxttim alarm \
95         date_y2kbuggy date_y2kbug vxtidt_y2kbuggy vxtidt_y2kbug
96
97 .SUFFIXES:
98
99 # The logic here is partly dictated by the desire to keep the lib?77
100 # subdirs for compatibility with the Netlib version and because libU77
101 # has a different copyright; then the libe77 bit (EXTERNALly-callable
102 # versions) is funny.  Given that, as well as keeping things as simple
103 # as possible we want (at least) the following:
104 #  * Allow make to be run at the top level (all-target-libf2c), at this
105 #    level, or the subdirs of this level.  In the latter case we only
106 #    compile, rather than updating libg2c.a;
107 #  * A robust set of dependencies, so that we rebuild (as little as
108 #    possible) if a configuration file, g2c.h or any lib?77/*.c file
109 #    changes;
110 #  * Avoid unnecessary running of ar and ranlib;
111 #  * Expose parallelism where reasonable, but not as a priority.
112
113 # The intended top-level target here does a non-multilib build (via
114 # the dependency) and then (perhaps) builds multilibs.
115
116 all: all-unilib
117         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="all-unilib"
118
119 # `all-unilib' is the overall target in the absence of multilibs,
120 # meant to be invoked via multi-do for multilibs.
121
122 # Its dependencies can be satisfied in parallel.  The [fiu]77 targets
123 # update stamp files (object file lists, actually, see the subdir
124 # makefiles) on which the $(LIBG2C) depends.  The stamp files
125 # s-lib[fiu]77 are intentionally not targets, since we're only meant
126 # to come in at the level of this target.  The [fiu]77 targets always
127 # invoke sub makes to check dependencies in the subdirs, else we'd
128 # have to maintain them at this level; we live with the overhead of
129 # some recursive makes which may do nothing.
130
131 all-unilib: i77 f77 u77 s-libe77
132         $(MAKE) $(FLAGS_TO_PASS) $(LIBG2C)
133
134 i77 f77 u77: g2c.h
135
136 # This target should normally only get invoked via `all-unilib' --
137 # after all's well in the subdirs -- actually to assemble the library.
138 # The stamp files contain the object lists of each component of the
139 # library.  The point of breaking them up is to avoid command-line
140 # length limitations.
141
142 $(LIBG2C): s-libi77 s-libf77 s-libu77 s-libe77
143         $(LIBTOOL) --mode=link $(CC) -o $@ \
144           -version-info $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_SUB) \
145           -rpath $(libdir)$(MULTISUBDIR) \
146           -objectlist s-libe77 \
147           -objectlist s-libf77 \
148           -objectlist s-libi77 \
149           -objectlist s-libu77 \
150           -lm
151
152 i77:
153         cd libI77; $(MAKE) $(FLAGS_TO_PASS) all
154
155 f77:
156         cd libF77; $(MAKE) $(FLAGS_TO_PASS) all
157
158 u77:
159         cd libU77; $(MAKE) $(FLAGS_TO_PASS) all
160
161 s-libe77: f2cext.c
162         if [ -d libE77 ]; then rm -f libE77/*.o libE77/*.lo; else mkdir libE77; fi
163         -rm -f $@.T $@
164         for name in $(F2CEXT); \
165         do \
166           echo $${name}; \
167           $(LIBTOOL) --mode=compile $(CC) -c -I. -I$(srcdir) -I../../include \
168             $(CPPFLAGS) $(CFLAGS) -DL$${name} $(srcdir)/f2cext.c \
169             -o libE77/L$${name}.lo ; \
170           if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
171           echo libE77/L$${name}.lo >> $@.T; \
172         done
173         mv $@.T $@
174
175 f2cext.c: g2c.h
176
177 ${srcdir}/configure: configure.in
178         rm -f config.cache
179         cd $(srcdir) && autoconf
180
181 # Dependence on Makefile serializes for parallel make.
182 g2c.h: g2c.hin config.status Makefile
183 # Might try to avoid rebuilding everything if Makefile or configure
184 # changes and g2c.h doesn't; see also the Makefile rule.  Should
185 # depend on another stamp file rather than using the commented-out
186 # lines below, since g2c.h isn't necessarily brought up to date.
187 #       mv g2c.h g2c.x
188         $(SHELL) config.status
189 #       $(SHELL) $(srcdir)/../move-if-change g2c.h g2c.x && mv g2c.x g2c.h
190
191 Makefile: Makefile.in config.status
192 # Autoconf doc uses `./config.status'.  Is there a good reason to use $(SHELL)?
193           $(SHELL) config.status
194
195 config.status: configure $(gcc_version_trigger)
196 # Make sure we don't pick up a site config file and that configure
197 # gets run with correct values of variables such as CC.
198         CONFIG_SITE=no-such-file $(FLAGS_TO_PASS) \
199           $(SHELL) config.status --recheck
200
201 info install-info clean-info dvi TAGS dist installcheck installdirs:
202
203 check:
204         cd libU77; $(MAKE) G77DIR=../../../gcc/ check
205
206 install: all
207         $(LIBTOOL) --mode=install $(INSTALL) $(LIBG2C) $(libdir)$(MULTISUBDIR)
208         $(INSTALL_DATA) libfrtbegin.a $(libsubdir)/$(MULTISUBDIR)
209         $(RANLIB) $(libsubdir)/$(MULTISUBDIR)/libfrtbegin.a
210         $(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
211         @if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
212           echo ''; \
213           echo 'Warning: g77 no longer installs libf2c.a or f2c.h.'; \
214           echo '         You must do so yourself.  For more information,'; \
215           echo '         read "Distributing Binaries" in the g77 docs.'; \
216           echo '         (To turn off this warning, delete the file'; \
217           echo '         f2c-install-ok in the source or build directory.)'; \
218           echo ''; \
219         else true; fi
220         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
221         @-$(LIBTOOL) --mode=finish $(prefix)/lib
222
223 install-strip:
224         $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
225
226 uninstall:
227         rm -f $(libsubdir)/$(MULTISUBDIR)/include/g2c.h $(libdir)$(MULTISUBDIR)/$(LIBG2C_BASE).*
228         rm -f $(prefix)/lib/$(LIBG2C_BASE).so*
229         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
230
231 mostlyclean:
232         rm -f $(LIBG2C) objlist
233         $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
234         $(MULTICLEAN) multi-clean DO=$@
235         rm -fr libE77 s-libe77
236
237 clean: mostlyclean
238         rm -f config.log
239         $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
240         $(MULTICLEAN) multi-clean DO=$@
241         rm -rf .libs
242
243 distclean: clean
244         rm -f g2c.h s-libe77
245         $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \
246         $(MULTICLEAN) multi-clean DO=distclean
247         rm -f config.cache config.status Makefile
248
249 maintainer-clean:
250
251 rebuilt: configure
252
253 .PHONY: rebuilt mostlyclean clean distclean maintainer-clean all \
254         i77 f77 u77 check uninstall install-strip dist \
255         installcheck installdirs all-unilib
256
257 subdir_do:
258         @rootpre=`pwd`/; export rootpre; \
259         srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
260         for i in .. $(DODIRS); do \
261           if [ x$$i != x.. ]; then \
262             if [ -f ./$$i/Makefile ]; then \
263               if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \
264                 true; \
265               else \
266                 exit 1; \
267               fi; \
268             else true; fi; \
269           else true; fi; \
270         done
271
272 # multidoings may be added here by configure.