]>
Commit | Line | Data |
---|---|---|
6de9cd9a DN |
1 | # -*- makefile -*- |
2 | # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler. | |
7adcbafe | 3 | # Copyright (C) 2002-2022 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 | 27 | # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, |
55bcd32b | 28 | # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, |
b7826893 | 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 | 54 | F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \ |
d15bac21 JW |
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 | |
6de9cd9a | 62 | |
c776a6d0 | 63 | F95_OBJS = $(F95_PARSER_OBJS) $(FORTRAN_TARGET_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 | 67 | fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \ |
601d98be | 68 | fortran/trans-stmt.o fortran/trans-types.o fortran/frontend-passes.o |
6de9cd9a | 69 | |
9e33f723 | 70 | fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o |
6cba282a | 71 | |
6de9cd9a DN |
72 | #\f |
73 | # Define the names for selecting gfortran in LANGUAGES. | |
9d29a5b7 | 74 | fortran: f951$(exeext) |
a774a6a2 | 75 | fortran.serial = f951$(exeext) |
6de9cd9a DN |
76 | |
77 | # Tell GNU make to ignore files by these names if they exist. | |
a774a6a2 | 78 | .PHONY: fortran |
6de9cd9a | 79 | |
9e33f723 | 80 | CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES) |
6de9cd9a DN |
81 | |
82 | # Create the compiler driver gfortran. | |
9e33f723 | 83 | GFORTRAN_D_OBJS = $(GCC_OBJS) fortran/gfortranspec.o |
1ed1641d JM |
84 | gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
85 | $(LIBDEPS) | |
a90163e9 | 86 | +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
e3b3fa45 RO |
87 | $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ |
88 | $(EXTRA_GCC_LIBS) $(LIBS) | |
6de9cd9a DN |
89 | |
90 | # Create a version of the gfortran driver which calls the cross-compiler. | |
91 | gfortran-cross$(exeext): gfortran$(exeext) | |
92 | -rm -f gfortran-cross$(exeext) | |
93 | cp gfortran$(exeext) gfortran-cross$(exeext) | |
94 | ||
95 | # The compiler itself is called f951. | |
a774a6a2 | 96 | f951$(exeext): $(F95_OBJS) $(BACKEND) $(LIBDEPS) attribs.o $(fortran.prev) |
d326ebc9 | 97 | @$(call LINK_PROGRESS,$(INDEX.fortran),start) |
427b248d | 98 | +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ |
9c818d13 JB |
99 | $(F95_OBJS) $(BACKEND) $(ZLIB) $(LIBS) attribs.o \ |
100 | $(BACKENDLIBS) | |
d326ebc9 | 101 | @$(call LINK_PROGRESS,$(INDEX.fortran),end) |
6de9cd9a | 102 | |
2f4d2d18 | 103 | gt-fortran-trans.h : s-gtype; @true |
6de9cd9a DN |
104 | #\f |
105 | # Build hooks: | |
106 | ||
7f26dfa3 | 107 | fortran.all.cross: gfortran-cross$(exeext) |
6de9cd9a | 108 | |
7f26dfa3 FXC |
109 | fortran.start.encap: gfortran$(exeext) |
110 | fortran.rest.encap: | |
6de9cd9a | 111 | |
41a45cba | 112 | fortran.srcinfo: doc/gfortran/info/texinfo/gfortran.info |
6de9cd9a DN |
113 | -cp -p $^ $(srcdir)/fortran |
114 | ||
7f26dfa3 | 115 | fortran.tags: force |
a8b5d635 | 116 | cd $(srcdir)/fortran; $(ETAGS) -o TAGS.sub *.cc *.h; \ |
909b30a1 | 117 | $(ETAGS) --include TAGS.sub --include ../TAGS.sub |
6de9cd9a | 118 | |
41a45cba | 119 | fortran.info: doc/gfortran/info/texinfo/gfortran.info doc/gfc-internals/info/texinfo/gfc-internals.info |
c3e80a16 | 120 | |
41a45cba ML |
121 | doc/gfortran/info/texinfo/gfortran.info: $(SPHINX_FILES) |
122 | + if [ x$(SPHINX_BUILD) = xsphinx-build ]; then \ | |
123 | make -C $(srcdir)/../doc info SOURCEDIR=$(abs_srcdir)/fortran/doc/gfortran BUILDDIR=$(objdir)/doc/gfortran/info; \ | |
124 | else true; fi | |
55bcd32b | 125 | |
41a45cba | 126 | F95_HTMLFILES = doc/fortran/html/html/index.html |
55bcd32b | 127 | |
41a45cba | 128 | fortran.html: $(F95_HTMLFILES) doc/gfc-internals/html/html/index.html |
55bcd32b AJ |
129 | |
130 | fortran.install-html: $(F95_HTMLFILES) | |
131 | @$(NORMAL_INSTALL) | |
132 | test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" | |
133 | @list='$(F95_HTMLFILES)'; for p in $$list; do \ | |
134 | if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ | |
135 | f=$(html__strip_dir) \ | |
136 | if test -d "$$d$$p"; then \ | |
137 | echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ | |
138 | $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ | |
139 | echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ | |
140 | $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ | |
141 | else \ | |
142 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ | |
143 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ | |
144 | fi; \ | |
145 | done | |
6de9cd9a | 146 | |
41a45cba | 147 | F95_PDFFILES = doc/fortran/pdf/latex/gfortran.pdf |
b7826893 | 148 | |
41a45cba | 149 | fortran.pdf: $(F95_PDFFILES) doc/gfc-internals/pdf/latex/gfc-internals.pdf |
b7826893 BM |
150 | |
151 | fortran.install-pdf: $(F95_PDFFILES) | |
152 | @$(NORMAL_INSTALL) | |
153 | test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" | |
154 | @list='$(F95_PDFFILES)'; for p in $$list; do \ | |
155 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
156 | f=$(pdf__strip_dir) \ | |
157 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ | |
158 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ | |
159 | done | |
160 | ||
41a45cba ML |
161 | F95_MANFILES = doc/gfortran/man/man/gfortran.1 |
162 | ||
163 | doc/gfortran/man/man/gfortran.1: $(SPHINX_FILES) | |
164 | + make -C $(srcdir)/../doc man SOURCEDIR=$(abs_srcdir)/fortran/doc/gfortran BUILDDIR=$(objdir)/doc/gfortran/man | |
e62be46e | 165 | |
7f26dfa3 | 166 | fortran.man: $(F95_MANFILES) |
e62be46e | 167 | |
7f26dfa3 | 168 | fortran.srcman: $(F95_MANFILES) |
e62be46e MK |
169 | -cp -p $^ $(srcdir)/doc |
170 | ||
7f26dfa3 | 171 | fortran.srcextra: |
6de9cd9a DN |
172 | |
173 | check-f95 : check-gfortran | |
2c05c0da | 174 | check-fortran : check-gfortran |
7134e605 JJ |
175 | check-f95-subtargets : check-gfortran-subtargets |
176 | check-fortran-subtargets : check-gfortran-subtargets | |
6de9cd9a | 177 | lang_checks += check-gfortran |
7134e605 | 178 | lang_checks_parallelized += check-gfortran |
a95492ab | 179 | # For description see the check_$lang_parallelize comment in gcc/Makefile.in. |
717c4789 | 180 | check_gfortran_parallelize = 10000 |
6de9cd9a | 181 | |
033eb567 DM |
182 | # No fortran-specific selftests |
183 | selftest-fortran: | |
184 | ||
41a45cba ML |
185 | doc/fortran/pdf/latex/gfortran.pdf: $(SPHINX_FILES) |
186 | + make -C $(srcdir)/../doc latexpdf SOURCEDIR=$(abs_srcdir)/fortran/doc/gfortran BUILDDIR=$(objdir)/doc/fortran/pdf | |
6de9cd9a | 187 | |
41a45cba ML |
188 | doc/fortran/html/html/index.html: $(SPHINX_FILES) |
189 | + make -C $(srcdir)/../doc html SOURCEDIR=$(abs_srcdir)/fortran/doc/gfortran BUILDDIR=$(objdir)/doc/fortran/html | |
e62be46e | 190 | |
52f2f1d7 | 191 | # GFORTRAN internals documentation. |
41a45cba ML |
192 | doc/gfc-internals/info/texinfo/gfc-internals.info: $(SPHINX_FILES) |
193 | + if [ x$(SPHINX_BUILD) = xsphinx-build ]; then \ | |
194 | make -C $(srcdir)/../doc info SOURCEDIR=$(abs_srcdir)/fortran/doc/gfc-internals BUILDDIR=$(objdir)/doc/gfc-internals/info; \ | |
52f2f1d7 BM |
195 | else true; fi |
196 | ||
41a45cba ML |
197 | doc/gfc-internals/pdf/latex/gfc-internals.pdf: $(SPHINX_FILES) |
198 | + make -C $(srcdir)/../doc latexpdf SOURCEDIR=$(abs_srcdir)/fortran/doc/gfc-internals BUILDDIR=$(objdir)/doc/gfc-internals/pdf | |
52f2f1d7 | 199 | |
41a45cba ML |
200 | doc/gfc-internals/html/html/index.html: $(SPHINX_FILES) |
201 | + make -C $(srcdir)/../doc html SOURCEDIR=$(abs_srcdir)/fortran/doc/gfc-internals BUILDDIR=$(objdir)/doc/gfc-internals/html | |
52f2f1d7 | 202 | |
dd8d6dfe JJ |
203 | # Create or recreate the gfortran private include file directory. |
204 | install-finclude-dir: installdirs | |
150da9f4 | 205 | $(mkinstalldirs) -m 0755 $(DESTDIR)$(libsubdir)/finclude |
6de9cd9a DN |
206 | #\f |
207 | # Install hooks: | |
208 | # f951 is installed elsewhere as part of $(COMPILERS). | |
209 | ||
90ae7019 BM |
210 | # Install the driver program as $(target)-gfortran, and also as gfortran |
211 | # if native. | |
dd8d6dfe | 212 | fortran.install-common: install-finclude-dir installdirs |
85c64bbe BS |
213 | -if test "$(enable_as_accelerator)" != "yes" ; then \ |
214 | if [ -f f951$(exeext) ] ; then \ | |
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); \ | |
218 | if [ ! -f gfortran-cross$(exeext) ] ; then \ | |
219 | rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ | |
220 | $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ | |
221 | fi ; \ | |
222 | fi; \ | |
6de9cd9a DN |
223 | fi |
224 | ||
2a4c0366 TG |
225 | fortran.install-plugin: |
226 | ||
b2d7fd7b | 227 | fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info |
6de9cd9a | 228 | |
41a45cba ML |
229 | $(DESTDIR)$(infodir)/gfortran.info: doc/gfortran/info/texinfo/gfortran.info installdirs |
230 | -rm -f $@ | |
231 | -$(INSTALL_DATA) $< $@ | |
232 | ||
7f26dfa3 | 233 | fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext) |
e62be46e | 234 | |
41a45cba | 235 | $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran/man/man/gfortran.1 \ |
7bfb5ccc | 236 | installdirs |
e62be46e MK |
237 | -rm -f $@ |
238 | -$(INSTALL_DATA) $< $@ | |
239 | -chmod a-x $@ | |
6de9cd9a | 240 | |
7f26dfa3 | 241 | fortran.uninstall: |
6de9cd9a DN |
242 | if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ |
243 | echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \ | |
244 | install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \ | |
245 | else : ; fi; \ | |
246 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \ | |
e62be46e | 247 | rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \ |
def6f170 | 248 | rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \ |
6de9cd9a DN |
249 | rm -rf $(DESTDIR)$(infodir)/gfortran.info* |
250 | ||
251 | #\f | |
252 | # Clean hooks: | |
253 | # A lot of the ancillary files are deleted by the main makefile. | |
254 | # We just have to delete files specific to us. | |
255 | ||
7f26dfa3 | 256 | fortran.mostlyclean: |
46bf0b0a | 257 | -rm -f gfortran$(exeext) gfortran-cross$(exeext) f951$(exeext) |
6de9cd9a DN |
258 | -rm -f fortran/*.o |
259 | ||
7f26dfa3 FXC |
260 | fortran.clean: |
261 | fortran.distclean: | |
6de9cd9a | 262 | -rm -f fortran/config.status fortran/Makefile |
6de9cd9a DN |
263 | #\f |
264 | # Stage hooks: | |
265 | # The toplevel makefile has already created stage?/fortran at this point. | |
266 | ||
7f26dfa3 | 267 | fortran.stage1: stage1-start |
6de9cd9a | 268 | -mv fortran/*$(objext) stage1/fortran |
7f26dfa3 | 269 | fortran.stage2: stage2-start |
6de9cd9a | 270 | -mv fortran/*$(objext) stage2/fortran |
7f26dfa3 | 271 | fortran.stage3: stage3-start |
6de9cd9a | 272 | -mv fortran/*$(objext) stage3/fortran |
7f26dfa3 | 273 | fortran.stage4: stage4-start |
6de9cd9a | 274 | -mv fortran/*$(objext) stage4/fortran |
7f26dfa3 | 275 | fortran.stageprofile: stageprofile-start |
6de9cd9a | 276 | -mv fortran/*$(objext) stageprofile/fortran |
7f26dfa3 | 277 | fortran.stagefeedback: stageprofile-start |
6de9cd9a | 278 | -mv fortran/*$(objext) stagefeedback/fortran |
e980df8e TT |
279 | |
280 | #\f | |
e980df8e | 281 | |
ce86ad58 | 282 | CFLAGS-fortran/cpp.o += $(TARGET_SYSTEM_ROOT_DEFINE) |
9c818d13 | 283 | CFLAGS-fortran/module.o += $(ZLIBINC) |