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