OSDN Git Service

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