Fix oversight in handling of reverse SSO in SRA pass
[official-gcc.git] / gcc / fortran / Make-lang.in
blob63195a9c7edf6fed4b270bd71701b470e0af819c
1 # -*- makefile -*-
2 # Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler.
3 # Copyright (C) 2002-2021 Free Software Foundation, Inc.
4 # Contributed by Paul Brook <paul@nowt.org
5 # and Steven Bosscher <s.bosscher@student.tudelft.nl>
7 #This file is part of GCC.
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.
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.
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/>.
23 # This file provides the language dependent support in the main Makefile.
24 # Each language makefile fragment must provide the following targets:
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
32 # where `foo' is the name of the language.
34 # It should also provide rules for:
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/).
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)')
45 #^L
47 # Use strict warnings for this front end.
48 fortran-warn = $(STRICT_WARN)
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
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
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
70 fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o
72 #\f
73 # Define the names for selecting gfortran in LANGUAGES.
74 fortran: f951$(exeext)
75 fortran.serial = f951$(exeext)
77 # Tell GNU make to ignore files by these names if they exist.
78 .PHONY: fortran
80 CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES)
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)
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)
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)
103 gt-fortran-trans.h    : s-gtype; @true
105 # Build hooks:
107 fortran.all.cross: gfortran-cross$(exeext)
109 fortran.start.encap: gfortran$(exeext)
110 fortran.rest.encap:
112 fortran.srcinfo: doc/gfortran.info
113         -cp -p $^ $(srcdir)/fortran
115 fortran.tags: force
116         cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
117         etags --include TAGS.sub --include ../TAGS.sub
119 fortran.info: doc/gfortran.info doc/gfc-internals.info
120 fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi
122 F95_HTMLFILES = $(build_htmldir)/gfortran
124 fortran.html: $(F95_HTMLFILES)/index.html
126 fortran.install-html: $(F95_HTMLFILES)
127         @$(NORMAL_INSTALL)
128         test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
129         @list='$(F95_HTMLFILES)'; for p in $$list; do \
130           if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
131           f=$(html__strip_dir) \
132           if test -d "$$d$$p"; then \
133             echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
134             $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
135             echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
136             $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
137           else \
138             echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
139             $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
140           fi; \
141         done
143 F95_PDFFILES = doc/gfortran.pdf
145 fortran.pdf: $(F95_PDFFILES) doc/gfc-internals.pdf
147 fortran.install-pdf: $(F95_PDFFILES)
148         @$(NORMAL_INSTALL)
149         test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
150         @list='$(F95_PDFFILES)'; for p in $$list; do \
151           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
152           f=$(pdf__strip_dir) \
153           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
154           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
155         done
157 F95_MANFILES = doc/gfortran.1
159 fortran.man: $(F95_MANFILES)
161 fortran.srcman: $(F95_MANFILES)
162         -cp -p $^ $(srcdir)/doc
164 fortran.srcextra:
166 check-f95 : check-gfortran
167 check-fortran : check-gfortran
168 check-f95-subtargets : check-gfortran-subtargets
169 check-fortran-subtargets : check-gfortran-subtargets
170 lang_checks += check-gfortran
171 lang_checks_parallelized += check-gfortran
172 # For description see the check_$lang_parallelize comment in gcc/Makefile.in.
173 check_gfortran_parallelize = 10000
175 # No fortran-specific selftests
176 selftest-fortran:
178 # GFORTRAN documentation.
179 GFORTRAN_TEXI = \
180   $(srcdir)/fortran/gfortran.texi \
181   $(srcdir)/fortran/intrinsic.texi \
182   $(srcdir)/fortran/invoke.texi \
183   $(srcdir)/doc/include/fdl.texi \
184   $(srcdir)/doc/include/gpl_v3.texi \
185   $(srcdir)/doc/include/funding.texi \
186   $(srcdir)/doc/include/gcc-common.texi \
187   gcc-vers.texi
189 doc/gfortran.info: $(GFORTRAN_TEXI)
190         if [ x$(BUILD_INFO) = xinfo ]; then \
191           rm -f doc/gfortran.info-*; \
192           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
193             -o $@ $<; \
194         else true; fi
196 doc/gfortran.dvi: $(GFORTRAN_TEXI)
197         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
199 doc/gfortran.pdf: $(GFORTRAN_TEXI)
200         $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
202 $(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
203         $(mkinstalldirs) $(@D)
204         rm -f $(@D)/*
205         $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $<
207 .INTERMEDIATE: gfortran.pod
209 gfortran.pod: $(GFORTRAN_TEXI)
210         -$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" \
211           < $(srcdir)/fortran/invoke.texi > $@
213 # GFORTRAN internals documentation.
214 GFC_INTERNALS_TEXI = \
215   $(srcdir)/fortran/gfc-internals.texi \
216   $(srcdir)/doc/include/fdl.texi \
217   $(srcdir)/doc/include/gcc-common.texi \
218   gcc-vers.texi
220 doc/gfc-internals.info: $(GFC_INTERNALS_TEXI)
221         if [ x$(BUILD_INFO) = xinfo ]; then \
222           rm -f doc/gfc-internals.info-*; \
223           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
224             -o $@ $<; \
225         else true; fi
227 doc/gfc-internals.dvi: $(GFC_INTERNALS_TEXI)
228         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
230 doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI)
231         $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
233 # Create or recreate the gfortran private include file directory.
234 install-finclude-dir: installdirs
235         $(mkinstalldirs) -m 0755 $(DESTDIR)$(libsubdir)/finclude
237 # Install hooks:
238 # f951 is installed elsewhere as part of $(COMPILERS).
240 # Install the driver program as $(target)-gfortran, and also as gfortran
241 # if native.
242 fortran.install-common: install-finclude-dir installdirs
243         -if test "$(enable_as_accelerator)" != "yes" ; then \
244           if [ -f f951$(exeext) ] ; then \
245             rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
246             $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
247             chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
248             if [ ! -f gfortran-cross$(exeext) ] ; then \
249               rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
250               $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
251             fi ; \
252           fi; \
253         fi
255 fortran.install-plugin:
257 fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
259 fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
261 $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
262                 installdirs
263         -rm -f $@
264         -$(INSTALL_DATA) $< $@
265         -chmod a-x $@
267 fortran.uninstall:
268         if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
269           echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
270           install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
271         else : ; fi; \
272         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
273         rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
274         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
275         rm -rf $(DESTDIR)$(infodir)/gfortran.info*
278 # Clean hooks:
279 # A lot of the ancillary files are deleted by the main makefile.
280 # We just have to delete files specific to us.
282 fortran.mostlyclean:
283         -rm -f gfortran$(exeext) gfortran-cross$(exeext) f951$(exeext)
284         -rm -f fortran/*.o
286 fortran.clean:
287 fortran.distclean:
288         -rm -f fortran/config.status fortran/Makefile
290 fortran.extraclean:
291 fortran.maintainer-clean:
292         -rm -f doc/gfortran.info* fortran/gfortran.*aux
293         -rm -f $(docobjdir)/gfortran.1
296 # Stage hooks:
297 # The toplevel makefile has already created stage?/fortran at this point.
299 fortran.stage1: stage1-start
300         -mv fortran/*$(objext) stage1/fortran
301 fortran.stage2: stage2-start
302         -mv fortran/*$(objext) stage2/fortran
303 fortran.stage3: stage3-start
304         -mv fortran/*$(objext) stage3/fortran
305 fortran.stage4: stage4-start
306         -mv fortran/*$(objext) stage4/fortran
307 fortran.stageprofile: stageprofile-start
308         -mv fortran/*$(objext) stageprofile/fortran
309 fortran.stagefeedback: stageprofile-start
310         -mv fortran/*$(objext) stagefeedback/fortran
314 CFLAGS-fortran/cpp.o += $(TARGET_SYSTEM_ROOT_DEFINE)
315 CFLAGS-fortran/module.o += $(ZLIBINC)