]>
Commit | Line | Data |
---|---|---|
6de9cd9a DN |
1 | # -*- makefile -*- |
2 | # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler. | |
d234d788 | 3 | # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
6de9cd9a DN |
4 | # Contributed by Paul Brook <paul@nowt.org |
5 | # and Steven Bosscher <s.bosscher@student.tudelft.nl> | |
6 | ||
9fc4d79b | 7 | #This file is part of GCC. |
6de9cd9a | 8 | |
9fc4d79b | 9 | #GCC is free software; you can redistribute it and/or modify |
6de9cd9a | 10 | #it under the terms of the GNU General Public License as published by |
d234d788 | 11 | #the Free Software Foundation; either version 3, or (at your option) |
6de9cd9a DN |
12 | #any later version. |
13 | ||
9fc4d79b | 14 | #GCC is distributed in the hope that it will be useful, |
6de9cd9a DN |
15 | #but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | #GNU General Public License for more details. | |
18 | ||
19 | #You should have received a copy of the GNU General Public License | |
d234d788 NC |
20 | #along with GCC; see the file COPYING3. If not see |
21 | #<http://www.gnu.org/licenses/>. | |
6de9cd9a DN |
22 | |
23 | # This file provides the language dependent support in the main Makefile. | |
24 | # Each language makefile fragment must provide the following targets: | |
25 | # | |
bd97af06 | 26 | # foo.all.cross, foo.start.encap, foo.rest.encap, |
b7826893 BM |
27 | # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, |
28 | # foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, | |
29 | # foo.mostlyclean, foo.clean, foo.distclean, | |
6de9cd9a DN |
30 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 |
31 | # | |
32 | # where `foo' is the name of the language. | |
33 | # | |
34 | # It should also provide rules for: | |
35 | # | |
36 | # - making any compiler driver (eg: gfortran) | |
37 | # - the compiler proper (eg: f951) | |
38 | # - define the names for selecting the language in LANGUAGES. | |
39 | # $(srcdir) must be set to the gcc/ source directory (*not* gcc/fortran/). | |
40 | ||
41 | # Actual name to use when installing a native compiler. | |
e62be46e | 42 | GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)') |
def6f170 | 43 | GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)') |
6de9cd9a DN |
44 | |
45 | #^L | |
46 | ||
5f42ddb0 | 47 | # Use strict warnings for this front end. |
ffee7efd KG |
48 | fortran-warn = $(STRICT_WARN) |
49 | ||
6de9cd9a DN |
50 | # These are the groups of object files we have. The F95_PARSER_OBJS are |
51 | # all the front end files, the F95_OBJS are the files for the translation | |
974ede64 | 52 | # from the parse tree to GENERIC |
6de9cd9a | 53 | |
fd528377 TS |
54 | F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \ |
55 | fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o \ | |
56 | fortran/error.o fortran/expr.o fortran/interface.o \ | |
57 | fortran/intrinsic.o fortran/io.o fortran/iresolve.o \ | |
58 | fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \ | |
6c7a4dfd JJ |
59 | fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \ |
60 | fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \ | |
7433458d | 61 | fortran/symbol.o fortran/target-memory.o |
6de9cd9a DN |
62 | |
63 | F95_OBJS = $(F95_PARSER_OBJS) \ | |
fd528377 TS |
64 | fortran/convert.o fortran/dependency.o fortran/f95-lang.o \ |
65 | fortran/trans.o fortran/trans-array.o fortran/trans-common.o \ | |
66 | fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o \ | |
6c7a4dfd JJ |
67 | fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \ |
68 | fortran/trans-stmt.o fortran/trans-types.o | |
6de9cd9a | 69 | |
6de9cd9a DN |
70 | #\f |
71 | # Define the names for selecting gfortran in LANGUAGES. | |
9d29a5b7 | 72 | fortran: f951$(exeext) |
6de9cd9a DN |
73 | |
74 | # Tell GNU make to ignore files by these names if they exist. | |
9d29a5b7 | 75 | .PHONY: fortran |
6de9cd9a DN |
76 | |
77 | gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H) | |
78 | (SHLIB_LINK='$(SHLIB_LINK)' \ | |
79 | SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \ | |
80 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ | |
81 | $(INCLUDES) $(srcdir)/fortran/gfortranspec.c) | |
82 | ||
83 | # Create the compiler driver gfortran. | |
14c7833c | 84 | GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o version.o prefix.o intl.o |
6de9cd9a DN |
85 | gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) |
86 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
87 | $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) | |
88 | ||
89 | # Create a version of the gfortran driver which calls the cross-compiler. | |
90 | gfortran-cross$(exeext): gfortran$(exeext) | |
91 | -rm -f gfortran-cross$(exeext) | |
92 | cp gfortran$(exeext) gfortran-cross$(exeext) | |
93 | ||
94 | # The compiler itself is called f951. | |
974ede64 | 95 | f951$(exeext): $(F95_OBJS) \ |
c79efc4d | 96 | $(BACKEND) $(LIBDEPS) attribs.o |
6de9cd9a | 97 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ |
c79efc4d | 98 | $(F95_OBJS) $(BACKEND) $(LIBS) attribs.o |
6de9cd9a | 99 | |
2f4d2d18 | 100 | gt-fortran-trans.h : s-gtype; @true |
6de9cd9a DN |
101 | #\f |
102 | # Build hooks: | |
103 | ||
7f26dfa3 | 104 | fortran.all.cross: gfortran-cross$(exeext) |
6de9cd9a | 105 | |
7f26dfa3 FXC |
106 | fortran.start.encap: gfortran$(exeext) |
107 | fortran.rest.encap: | |
6de9cd9a | 108 | |
7f26dfa3 | 109 | fortran.srcinfo: doc/gfortran.info |
6de9cd9a DN |
110 | -cp -p $^ $(srcdir)/fortran |
111 | ||
7f26dfa3 | 112 | fortran.tags: force |
6de9cd9a DN |
113 | cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \ |
114 | etags --include TAGS.sub --include ../TAGS.sub | |
115 | ||
52f2f1d7 BM |
116 | fortran.info: doc/gfortran.info doc/gfc-internals.info |
117 | fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi | |
22482f74 | 118 | fortran.html: $(build_htmldir)/gfortran/index.html |
6de9cd9a | 119 | |
b7826893 BM |
120 | F95_PDFFILES = doc/gfortran.pdf |
121 | ||
52f2f1d7 | 122 | fortran.pdf: $(F95_PDFFILES) doc/gfc-internals.pdf |
b7826893 BM |
123 | |
124 | fortran.install-pdf: $(F95_PDFFILES) | |
125 | @$(NORMAL_INSTALL) | |
126 | test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" | |
127 | @list='$(F95_PDFFILES)'; for p in $$list; do \ | |
128 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
129 | f=$(pdf__strip_dir) \ | |
130 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ | |
131 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ | |
132 | done | |
133 | ||
e62be46e MK |
134 | F95_MANFILES = doc/gfortran.1 |
135 | ||
7f26dfa3 | 136 | fortran.man: $(F95_MANFILES) |
e62be46e | 137 | |
7f26dfa3 | 138 | fortran.srcman: $(F95_MANFILES) |
e62be46e MK |
139 | -cp -p $^ $(srcdir)/doc |
140 | ||
7f26dfa3 | 141 | fortran.srcextra: |
6de9cd9a DN |
142 | |
143 | check-f95 : check-gfortran | |
2c05c0da | 144 | check-fortran : check-gfortran |
6de9cd9a DN |
145 | lang_checks += check-gfortran |
146 | ||
147 | # GFORTRAN documentation. | |
148 | GFORTRAN_TEXI = \ | |
149 | $(srcdir)/fortran/gfortran.texi \ | |
2e582661 | 150 | $(srcdir)/fortran/intrinsic.texi \ |
6de9cd9a DN |
151 | $(srcdir)/fortran/invoke.texi \ |
152 | $(srcdir)/doc/include/fdl.texi \ | |
153 | $(srcdir)/doc/include/gpl.texi \ | |
154 | $(srcdir)/doc/include/funding.texi \ | |
a1286ef5 ZW |
155 | $(srcdir)/doc/include/gcc-common.texi \ |
156 | gcc-vers.texi | |
6de9cd9a | 157 | |
fc897984 | 158 | doc/gfortran.info: $(GFORTRAN_TEXI) |
6de9cd9a | 159 | if [ x$(BUILD_INFO) = xinfo ]; then \ |
fc897984 | 160 | rm -f doc/gfortran.info-*; \ |
9d65c5cb MS |
161 | $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \ |
162 | -o $@ $<; \ | |
6de9cd9a DN |
163 | else true; fi |
164 | ||
fc897984 JM |
165 | doc/gfortran.dvi: $(GFORTRAN_TEXI) |
166 | $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
6de9cd9a | 167 | |
b5422ad7 BM |
168 | doc/gfortran.pdf: $(GFORTRAN_TEXI) |
169 | $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
170 | ||
22482f74 | 171 | $(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI) |
9d65c5cb MS |
172 | $(mkinstalldirs) $(@D) |
173 | rm -f $(@D)/* | |
ad3a7ce3 | 174 | $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $< |
9d65c5cb | 175 | |
e62be46e MK |
176 | .INTERMEDIATE: gfortran.pod |
177 | ||
178 | gfortran.pod: $(GFORTRAN_TEXI) | |
2f41c1d6 PB |
179 | -$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" \ |
180 | < $(srcdir)/fortran/invoke.texi > $@ | |
e62be46e | 181 | |
52f2f1d7 BM |
182 | # GFORTRAN internals documentation. |
183 | GFC_INTERNALS_TEXI = \ | |
184 | $(srcdir)/fortran/gfc-internals.texi \ | |
185 | $(srcdir)/doc/include/fdl.texi \ | |
186 | $(srcdir)/doc/include/gcc-common.texi \ | |
187 | gcc-vers.texi | |
188 | ||
189 | doc/gfc-internals.info: $(GFC_INTERNALS_TEXI) | |
190 | if [ x$(BUILD_INFO) = xinfo ]; then \ | |
191 | rm -f doc/gfc-internals.info-*; \ | |
192 | $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \ | |
193 | -o $@ $<; \ | |
194 | else true; fi | |
195 | ||
196 | doc/gfc-internals.dvi: $(GFC_INTERNALS_TEXI) | |
197 | $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
198 | ||
199 | doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI) | |
200 | $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
201 | ||
dd8d6dfe JJ |
202 | # Create or recreate the gfortran private include file directory. |
203 | install-finclude-dir: installdirs | |
204 | -rm -rf $(DESTDIR)$(libsubdir)/finclude | |
205 | mkdir $(DESTDIR)$(libsubdir)/finclude | |
206 | -chmod a+rx $(DESTDIR)$(libsubdir)/finclude | |
6de9cd9a DN |
207 | #\f |
208 | # Install hooks: | |
209 | # f951 is installed elsewhere as part of $(COMPILERS). | |
210 | ||
6de9cd9a DN |
211 | # Install the driver program as $(target)-gfortran |
212 | # and also as either gfortran (if native) or $(tooldir)/bin/gfortran. | |
dd8d6dfe | 213 | fortran.install-common: install-finclude-dir installdirs |
6de9cd9a | 214 | -if [ -f f951$(exeext) ] ; then \ |
def6f170 AS |
215 | rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ |
216 | $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
217 | chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
6de9cd9a | 218 | if [ -f gfortran-cross$(exeext) ] ; then \ |
6de9cd9a DN |
219 | if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ |
220 | rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \ | |
221 | $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \ | |
222 | else true; fi; \ | |
223 | else \ | |
6de9cd9a DN |
224 | rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ |
225 | $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ | |
226 | fi ; \ | |
227 | fi | |
228 | ||
b2d7fd7b | 229 | fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info |
6de9cd9a | 230 | |
7f26dfa3 | 231 | fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext) |
e62be46e | 232 | |
7bfb5ccc GK |
233 | $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \ |
234 | installdirs | |
e62be46e MK |
235 | -rm -f $@ |
236 | -$(INSTALL_DATA) $< $@ | |
237 | -chmod a-x $@ | |
6de9cd9a | 238 | |
7f26dfa3 | 239 | fortran.uninstall: |
6de9cd9a DN |
240 | if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ |
241 | echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \ | |
242 | install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \ | |
243 | else : ; fi; \ | |
244 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
e62be46e | 245 | rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \ |
def6f170 | 246 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ |
6de9cd9a DN |
247 | rm -rf $(DESTDIR)$(infodir)/gfortran.info* |
248 | ||
249 | #\f | |
250 | # Clean hooks: | |
251 | # A lot of the ancillary files are deleted by the main makefile. | |
252 | # We just have to delete files specific to us. | |
253 | ||
7f26dfa3 | 254 | fortran.mostlyclean: |
6de9cd9a DN |
255 | -rm -f f951$(exeext) |
256 | -rm -f fortran/*.o | |
257 | ||
7f26dfa3 FXC |
258 | fortran.clean: |
259 | fortran.distclean: | |
6de9cd9a DN |
260 | -rm -f fortran/config.status fortran/Makefile |
261 | ||
7f26dfa3 FXC |
262 | fortran.extraclean: |
263 | fortran.maintainer-clean: | |
fc897984 | 264 | -rm -f doc/gfortran.info* fortran/gfortran.*aux |
e62be46e | 265 | -rm -f $(docobjdir)/gfortran.1 |
6de9cd9a DN |
266 | |
267 | #\f | |
268 | # Stage hooks: | |
269 | # The toplevel makefile has already created stage?/fortran at this point. | |
270 | ||
7f26dfa3 | 271 | fortran.stage1: stage1-start |
6de9cd9a | 272 | -mv fortran/*$(objext) stage1/fortran |
7f26dfa3 | 273 | fortran.stage2: stage2-start |
6de9cd9a | 274 | -mv fortran/*$(objext) stage2/fortran |
7f26dfa3 | 275 | fortran.stage3: stage3-start |
6de9cd9a | 276 | -mv fortran/*$(objext) stage3/fortran |
7f26dfa3 | 277 | fortran.stage4: stage4-start |
6de9cd9a | 278 | -mv fortran/*$(objext) stage4/fortran |
7f26dfa3 | 279 | fortran.stageprofile: stageprofile-start |
6de9cd9a | 280 | -mv fortran/*$(objext) stageprofile/fortran |
7f26dfa3 | 281 | fortran.stagefeedback: stageprofile-start |
6de9cd9a DN |
282 | -mv fortran/*$(objext) stagefeedback/fortran |
283 | ||
284 | #\f | |
285 | # .o: .h dependencies. | |
286 | ||
287 | # Everything depends on gfortran.h, but only a few files depend on | |
288 | # the other headers. So at some point we'll have to split out | |
289 | # which objects depend on what. FIXME | |
290 | # TODO: Add dependencies on the backend/tree header files | |
291 | ||
d74b97cc FXC |
292 | $(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \ |
293 | fortran/intrinsic.h fortran/match.h \ | |
7433458d | 294 | fortran/parse.h fortran/arith.h fortran/target-memory.h \ |
6de9cd9a DN |
295 | $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \ |
296 | $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \ | |
48779194 | 297 | $(FLAGS_H) output.h $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) |
6c7a4dfd | 298 | fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h |
6de9cd9a | 299 | |
d74b97cc FXC |
300 | GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \ |
301 | fortran/intrinsic.h fortran/trans-array.h \ | |
6de9cd9a DN |
302 | fortran/trans-const.h fortran/trans-const.h fortran/trans.h \ |
303 | fortran/trans-stmt.h fortran/trans-types.h \ | |
e2cad04b | 304 | $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H) |
6de9cd9a DN |
305 | |
306 | fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \ | |
48779194 | 307 | gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) \ |
6c7a4dfd | 308 | $(BUILTINS_DEF) fortran/types.def |
2d7c7df6 | 309 | fortran/scanner.o: toplev.h |
6de9cd9a DN |
310 | fortran/convert.o: $(GFORTRAN_TRANS_DEPS) |
311 | fortran/trans.o: $(GFORTRAN_TRANS_DEPS) | |
e2cad04b | 312 | fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \ |
48779194 VR |
313 | $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \ |
314 | $(TREE_DUMP_H) | |
e2cad04b | 315 | fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \ |
08789087 | 316 | $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) |
6de9cd9a | 317 | fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS) |
7a70c12d | 318 | fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h |
3ded6210 | 319 | fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h |
6c7a4dfd | 320 | fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS) |
5e805e44 JJ |
321 | fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \ |
322 | fortran/ioparm.def | |
6de9cd9a DN |
323 | fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS) |
324 | fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \ | |
325 | gt-fortran-trans-intrinsic.h | |
d1f3352f | 326 | fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h |
6c7a4dfd | 327 | fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H) |
1524f80b | 328 | fortran/resolve.o: fortran/dependency.h |
a5320d39 | 329 | fortran/options.o: $(PARAMS_H) $(TARGET_H) |