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