OSDN Git Service

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