]>
Commit | Line | Data |
---|---|---|
4ee9c684 | 1 | # -*- makefile -*- |
2 | # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler. | |
f1717362 | 3 | # Copyright (C) 2002-2016 Free Software Foundation, Inc. |
4ee9c684 | 4 | # Contributed by Paul Brook <paul@nowt.org |
5 | # and Steven Bosscher <s.bosscher@student.tudelft.nl> | |
6 | ||
c84b470d | 7 | #This file is part of GCC. |
4ee9c684 | 8 | |
c84b470d | 9 | #GCC is free software; you can redistribute it and/or modify |
4ee9c684 | 10 | #it under the terms of the GNU General Public License as published by |
bdabe786 | 11 | #the Free Software Foundation; either version 3, or (at your option) |
4ee9c684 | 12 | #any later version. |
13 | ||
c84b470d | 14 | #GCC is distributed in the hope that it will be useful, |
4ee9c684 | 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 | |
bdabe786 | 20 | #along with GCC; see the file COPYING3. If not see |
21 | #<http://www.gnu.org/licenses/>. | |
4ee9c684 | 22 | |
23 | # This file provides the language dependent support in the main Makefile. | |
24 | # Each language makefile fragment must provide the following targets: | |
25 | # | |
ae6555f9 | 26 | # foo.all.cross, foo.start.encap, foo.rest.encap, |
1f621530 | 27 | # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, |
fb433b0b | 28 | # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, |
1f621530 | 29 | # foo.mostlyclean, foo.clean, foo.distclean, |
4ee9c684 | 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. | |
5b08c6a3 | 42 | GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)') |
464947c4 | 43 | GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)') |
4ee9c684 | 44 | |
45 | #^L | |
46 | ||
be63aff0 | 47 | # Use strict warnings for this front end. |
d3d1d245 | 48 | fortran-warn = $(STRICT_WARN) |
49 | ||
4ee9c684 | 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 | |
778f9007 | 52 | # from the parse tree to GENERIC |
4ee9c684 | 53 | |
b131238a | 54 | F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \ |
b823b0c6 | 55 | fortran/check.o fortran/class.o fortran/constructor.o fortran/cpp.o \ |
56 | fortran/data.o fortran/decl.o fortran/dump-parse-tree.o fortran/error.o \ | |
57 | fortran/expr.o fortran/interface.o fortran/intrinsic.o fortran/io.o \ | |
58 | fortran/iresolve.o fortran/match.o fortran/matchexp.o fortran/misc.o \ | |
59 | fortran/module.o fortran/openmp.o fortran/options.o fortran/parse.o \ | |
60 | fortran/primary.o fortran/resolve.o fortran/scanner.o fortran/simplify.o \ | |
61 | fortran/st.o fortran/symbol.o fortran/target-memory.o | |
4ee9c684 | 62 | |
32006f36 | 63 | F95_OBJS = $(F95_PARSER_OBJS) $(FORTRAN_TARGET_OBJS) \ |
b131238a | 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 \ | |
764f1175 | 67 | fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \ |
5532a4d1 | 68 | fortran/trans-stmt.o fortran/trans-types.o fortran/frontend-passes.o |
4ee9c684 | 69 | |
d7bdd629 | 70 | fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o |
6fb2153a | 71 | |
4ee9c684 | 72 | #\f |
73 | # Define the names for selecting gfortran in LANGUAGES. | |
9f30f9e7 | 74 | fortran: f951$(exeext) |
4ee9c684 | 75 | |
76 | # Tell GNU make to ignore files by these names if they exist. | |
9f30f9e7 | 77 | .PHONY: fortran |
4ee9c684 | 78 | |
d7bdd629 | 79 | CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES) |
4ee9c684 | 80 | |
81 | # Create the compiler driver gfortran. | |
d7bdd629 | 82 | GFORTRAN_D_OBJS = $(GCC_OBJS) fortran/gfortranspec.o |
eb65953e | 83 | gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
84 | $(LIBDEPS) | |
70293f47 | 85 | +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
76fd9e61 | 86 | $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
87 | $(EXTRA_GCC_LIBS) $(LIBS) | |
4ee9c684 | 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. | |
778f9007 | 95 | f951$(exeext): $(F95_OBJS) \ |
54be5d7e | 96 | $(BACKEND) $(LIBDEPS) attribs.o |
be5f9e46 | 97 | +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
7de05b7d | 98 | $(F95_OBJS) $(BACKEND) $(ZLIB) $(LIBS) attribs.o \ |
99 | $(BACKENDLIBS) | |
4ee9c684 | 100 | |
758e52e0 | 101 | gt-fortran-trans.h : s-gtype; @true |
4ee9c684 | 102 | #\f |
103 | # Build hooks: | |
104 | ||
2c718da0 | 105 | fortran.all.cross: gfortran-cross$(exeext) |
4ee9c684 | 106 | |
2c718da0 | 107 | fortran.start.encap: gfortran$(exeext) |
108 | fortran.rest.encap: | |
4ee9c684 | 109 | |
2c718da0 | 110 | fortran.srcinfo: doc/gfortran.info |
4ee9c684 | 111 | -cp -p $^ $(srcdir)/fortran |
112 | ||
2c718da0 | 113 | fortran.tags: force |
4ee9c684 | 114 | cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \ |
115 | etags --include TAGS.sub --include ../TAGS.sub | |
116 | ||
a191dd08 | 117 | fortran.info: doc/gfortran.info doc/gfc-internals.info |
118 | fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi | |
fb433b0b | 119 | |
120 | F95_HTMLFILES = $(build_htmldir)/gfortran | |
121 | ||
122 | fortran.html: $(F95_HTMLFILES)/index.html | |
123 | ||
124 | fortran.install-html: $(F95_HTMLFILES) | |
125 | @$(NORMAL_INSTALL) | |
126 | test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" | |
127 | @list='$(F95_HTMLFILES)'; for p in $$list; do \ | |
128 | if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ | |
129 | f=$(html__strip_dir) \ | |
130 | if test -d "$$d$$p"; then \ | |
131 | echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ | |
132 | $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ | |
133 | echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ | |
134 | $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ | |
135 | else \ | |
136 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ | |
137 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ | |
138 | fi; \ | |
139 | done | |
4ee9c684 | 140 | |
1f621530 | 141 | F95_PDFFILES = doc/gfortran.pdf |
142 | ||
a191dd08 | 143 | fortran.pdf: $(F95_PDFFILES) doc/gfc-internals.pdf |
1f621530 | 144 | |
145 | fortran.install-pdf: $(F95_PDFFILES) | |
146 | @$(NORMAL_INSTALL) | |
147 | test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" | |
148 | @list='$(F95_PDFFILES)'; for p in $$list; do \ | |
149 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
150 | f=$(pdf__strip_dir) \ | |
151 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ | |
152 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ | |
153 | done | |
154 | ||
5b08c6a3 | 155 | F95_MANFILES = doc/gfortran.1 |
156 | ||
2c718da0 | 157 | fortran.man: $(F95_MANFILES) |
5b08c6a3 | 158 | |
2c718da0 | 159 | fortran.srcman: $(F95_MANFILES) |
5b08c6a3 | 160 | -cp -p $^ $(srcdir)/doc |
161 | ||
2c718da0 | 162 | fortran.srcextra: |
4ee9c684 | 163 | |
164 | check-f95 : check-gfortran | |
edcd3631 | 165 | check-fortran : check-gfortran |
a0d20ccb | 166 | check-f95-subtargets : check-gfortran-subtargets |
167 | check-fortran-subtargets : check-gfortran-subtargets | |
4ee9c684 | 168 | lang_checks += check-gfortran |
a0d20ccb | 169 | lang_checks_parallelized += check-gfortran |
eeec71b4 | 170 | # For description see the check_$lang_parallelize comment in gcc/Makefile.in. |
eb9bd3cc | 171 | check_gfortran_parallelize = 10000 |
4ee9c684 | 172 | |
173 | # GFORTRAN documentation. | |
174 | GFORTRAN_TEXI = \ | |
175 | $(srcdir)/fortran/gfortran.texi \ | |
ed367a2e | 176 | $(srcdir)/fortran/intrinsic.texi \ |
4ee9c684 | 177 | $(srcdir)/fortran/invoke.texi \ |
178 | $(srcdir)/doc/include/fdl.texi \ | |
eae7da65 | 179 | $(srcdir)/doc/include/gpl_v3.texi \ |
4ee9c684 | 180 | $(srcdir)/doc/include/funding.texi \ |
1af67e62 | 181 | $(srcdir)/doc/include/gcc-common.texi \ |
182 | gcc-vers.texi | |
4ee9c684 | 183 | |
4fafe3fa | 184 | doc/gfortran.info: $(GFORTRAN_TEXI) |
4ee9c684 | 185 | if [ x$(BUILD_INFO) = xinfo ]; then \ |
4fafe3fa | 186 | rm -f doc/gfortran.info-*; \ |
61a98835 | 187 | $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \ |
188 | -o $@ $<; \ | |
4ee9c684 | 189 | else true; fi |
190 | ||
4fafe3fa | 191 | doc/gfortran.dvi: $(GFORTRAN_TEXI) |
192 | $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
4ee9c684 | 193 | |
51f93521 | 194 | doc/gfortran.pdf: $(GFORTRAN_TEXI) |
195 | $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
196 | ||
85690e4d | 197 | $(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI) |
61a98835 | 198 | $(mkinstalldirs) $(@D) |
199 | rm -f $(@D)/* | |
77a85ce7 | 200 | $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $< |
61a98835 | 201 | |
5b08c6a3 | 202 | .INTERMEDIATE: gfortran.pod |
203 | ||
204 | gfortran.pod: $(GFORTRAN_TEXI) | |
d25dc80e | 205 | -$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" \ |
206 | < $(srcdir)/fortran/invoke.texi > $@ | |
5b08c6a3 | 207 | |
a191dd08 | 208 | # GFORTRAN internals documentation. |
209 | GFC_INTERNALS_TEXI = \ | |
210 | $(srcdir)/fortran/gfc-internals.texi \ | |
211 | $(srcdir)/doc/include/fdl.texi \ | |
212 | $(srcdir)/doc/include/gcc-common.texi \ | |
213 | gcc-vers.texi | |
214 | ||
215 | doc/gfc-internals.info: $(GFC_INTERNALS_TEXI) | |
216 | if [ x$(BUILD_INFO) = xinfo ]; then \ | |
217 | rm -f doc/gfc-internals.info-*; \ | |
218 | $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \ | |
219 | -o $@ $<; \ | |
220 | else true; fi | |
221 | ||
222 | doc/gfc-internals.dvi: $(GFC_INTERNALS_TEXI) | |
223 | $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
224 | ||
225 | doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI) | |
226 | $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $< | |
227 | ||
ebe48f5e | 228 | # Create or recreate the gfortran private include file directory. |
229 | install-finclude-dir: installdirs | |
03c0a493 | 230 | $(mkinstalldirs) -m 0755 $(DESTDIR)$(libsubdir)/finclude |
4ee9c684 | 231 | #\f |
232 | # Install hooks: | |
233 | # f951 is installed elsewhere as part of $(COMPILERS). | |
234 | ||
955edcde | 235 | # Install the driver program as $(target)-gfortran, and also as gfortran |
236 | # if native. | |
ebe48f5e | 237 | fortran.install-common: install-finclude-dir installdirs |
a3d93be3 | 238 | -if test "$(enable_as_accelerator)" != "yes" ; then \ |
239 | if [ -f f951$(exeext) ] ; then \ | |
240 | rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
241 | $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
242 | chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
243 | if [ ! -f gfortran-cross$(exeext) ] ; then \ | |
244 | rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ | |
245 | $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ | |
246 | fi ; \ | |
247 | fi; \ | |
4ee9c684 | 248 | fi |
249 | ||
c02b6f4e | 250 | fortran.install-plugin: |
251 | ||
25a2ad48 | 252 | fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info |
4ee9c684 | 253 | |
2c718da0 | 254 | fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext) |
5b08c6a3 | 255 | |
01ac74a6 | 256 | $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \ |
257 | installdirs | |
5b08c6a3 | 258 | -rm -f $@ |
259 | -$(INSTALL_DATA) $< $@ | |
260 | -chmod a-x $@ | |
4ee9c684 | 261 | |
2c718da0 | 262 | fortran.uninstall: |
4ee9c684 | 263 | if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ |
264 | echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \ | |
265 | install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \ | |
266 | else : ; fi; \ | |
267 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
5b08c6a3 | 268 | rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \ |
464947c4 | 269 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ |
4ee9c684 | 270 | rm -rf $(DESTDIR)$(infodir)/gfortran.info* |
271 | ||
272 | #\f | |
273 | # Clean hooks: | |
274 | # A lot of the ancillary files are deleted by the main makefile. | |
275 | # We just have to delete files specific to us. | |
276 | ||
2c718da0 | 277 | fortran.mostlyclean: |
b1891a46 | 278 | -rm -f gfortran$(exeext) gfortran-cross$(exeext) f951$(exeext) |
4ee9c684 | 279 | -rm -f fortran/*.o |
280 | ||
2c718da0 | 281 | fortran.clean: |
282 | fortran.distclean: | |
4ee9c684 | 283 | -rm -f fortran/config.status fortran/Makefile |
284 | ||
2c718da0 | 285 | fortran.extraclean: |
286 | fortran.maintainer-clean: | |
4fafe3fa | 287 | -rm -f doc/gfortran.info* fortran/gfortran.*aux |
5b08c6a3 | 288 | -rm -f $(docobjdir)/gfortran.1 |
4ee9c684 | 289 | |
290 | #\f | |
291 | # Stage hooks: | |
292 | # The toplevel makefile has already created stage?/fortran at this point. | |
293 | ||
2c718da0 | 294 | fortran.stage1: stage1-start |
4ee9c684 | 295 | -mv fortran/*$(objext) stage1/fortran |
2c718da0 | 296 | fortran.stage2: stage2-start |
4ee9c684 | 297 | -mv fortran/*$(objext) stage2/fortran |
2c718da0 | 298 | fortran.stage3: stage3-start |
4ee9c684 | 299 | -mv fortran/*$(objext) stage3/fortran |
2c718da0 | 300 | fortran.stage4: stage4-start |
4ee9c684 | 301 | -mv fortran/*$(objext) stage4/fortran |
2c718da0 | 302 | fortran.stageprofile: stageprofile-start |
4ee9c684 | 303 | -mv fortran/*$(objext) stageprofile/fortran |
2c718da0 | 304 | fortran.stagefeedback: stageprofile-start |
4ee9c684 | 305 | -mv fortran/*$(objext) stagefeedback/fortran |
21886706 | 306 | |
307 | #\f | |
21886706 | 308 | |
1a035bcc | 309 | CFLAGS-fortran/cpp.o += $(TARGET_SYSTEM_ROOT_DEFINE) |
7de05b7d | 310 | CFLAGS-fortran/module.o += $(ZLIBINC) |