OSDN Git Service

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