OSDN Git Service

PR fortran/31262
[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 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 2, 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 COPYING.  If not, write to
21 #the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 #Boston, MA 02110-1301, USA.
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.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 files get warnings from an inline function in GMP saying:
52 # "control may reach end of non-void function '__gmpz_get_ui' being inlined"
53 fortran/expr.o-warn = -Wno-error
54 fortran/resolve.o-warn = -Wno-error
55 fortran/simplify.o-warn = -Wno-error
56 fortran/trans-common.o-warn = -Wno-error
57
58 # These are the groups of object files we have.  The F95_PARSER_OBJS are
59 # all the front end files, the F95_OBJS are the files for the translation
60 # from the parse tree to GENERIC
61
62 F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
63     fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o \
64     fortran/error.o fortran/expr.o fortran/interface.o \
65     fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
66     fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
67     fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \
68     fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \
69     fortran/symbol.o
70
71 F95_OBJS = $(F95_PARSER_OBJS) \
72     fortran/convert.o fortran/dependency.o fortran/f95-lang.o \
73     fortran/trans.o fortran/trans-array.o fortran/trans-common.o \
74     fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o \
75     fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
76     fortran/trans-stmt.o fortran/trans-types.o
77
78 #\f
79 # Define the names for selecting gfortran in LANGUAGES.
80 fortran: f951$(exeext)
81
82 # Tell GNU make to ignore files by these names if they exist.
83 .PHONY: fortran
84
85 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H)
86         (SHLIB_LINK='$(SHLIB_LINK)' \
87         SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
88         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
89                 $(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
90
91 # Create the compiler driver gfortran.
92 GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o version.o prefix.o intl.o
93 gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
94         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
95           $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
96
97 # Create a version of the gfortran driver which calls the cross-compiler.
98 gfortran-cross$(exeext): gfortran$(exeext)
99         -rm -f gfortran-cross$(exeext)
100         cp gfortran$(exeext) gfortran-cross$(exeext)
101
102 # The compiler itself is called f951.
103 f951$(exeext): $(F95_OBJS) \
104                 $(BACKEND) $(LIBDEPS) attribs.o
105         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
106                 $(F95_OBJS) $(BACKEND) $(LIBS) attribs.o
107
108 gt-fortran-trans.h    : s-gtype; @true
109 #\f
110 # Build hooks:
111
112 fortran.all.cross: gfortran-cross$(exeext)
113
114 fortran.start.encap: gfortran$(exeext)
115 fortran.rest.encap:
116
117 fortran.srcinfo: doc/gfortran.info
118         -cp -p $^ $(srcdir)/fortran
119
120 fortran.tags: force
121         cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
122         etags --include TAGS.sub --include ../TAGS.sub
123
124 fortran.info: doc/gfortran.info
125 fortran.dvi: doc/gfortran.dvi
126 fortran.html: $(build_htmldir)/gfortran/index.html
127
128 F95_PDFFILES = doc/gfortran.pdf
129
130 fortran.pdf: $(F95_PDFFILES)
131
132 fortran.install-pdf: $(F95_PDFFILES)
133         @$(NORMAL_INSTALL)
134         test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
135         @list='$(F95_PDFFILES)'; for p in $$list; do \
136           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
137           f=$(pdf__strip_dir) \
138           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
139           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
140         done
141
142 F95_MANFILES = doc/gfortran.1
143
144 fortran.man: $(F95_MANFILES)
145
146 fortran.srcman: $(F95_MANFILES)
147         -cp -p $^ $(srcdir)/doc
148
149 fortran.srcextra:
150
151 check-f95 : check-gfortran
152 check-fortran : check-gfortran
153 lang_checks += check-gfortran
154
155 # GFORTRAN documentation.
156 GFORTRAN_TEXI = \
157   $(srcdir)/fortran/gfortran.texi \
158   $(srcdir)/fortran/intrinsic.texi \
159   $(srcdir)/fortran/invoke.texi \
160   $(srcdir)/doc/include/fdl.texi \
161   $(srcdir)/doc/include/gpl.texi \
162   $(srcdir)/doc/include/funding.texi \
163   $(srcdir)/doc/include/gcc-common.texi \
164   gcc-vers.texi
165
166 doc/gfortran.info: $(GFORTRAN_TEXI)
167         if [ x$(BUILD_INFO) = xinfo ]; then \
168           rm -f doc/gfortran.info-*; \
169           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
170             -o $@ $<; \
171         else true; fi
172
173 doc/gfortran.dvi: $(GFORTRAN_TEXI)
174         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
175
176 doc/gfortran.pdf: $(GFORTRAN_TEXI)
177         $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
178
179 $(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
180         $(mkinstalldirs) $(@D)
181         rm -f $(@D)/*
182         $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $<
183
184 .INTERMEDIATE: gfortran.pod
185
186 gfortran.pod: $(GFORTRAN_TEXI)
187         -$(TEXI2POD) < $(srcdir)/fortran/invoke.texi > $@
188
189 # Create or recreate the gfortran private include file directory.
190 install-finclude-dir: installdirs
191         -rm -rf $(DESTDIR)$(libsubdir)/finclude
192         mkdir $(DESTDIR)$(libsubdir)/finclude
193         -chmod a+rx $(DESTDIR)$(libsubdir)/finclude
194 #\f
195 # Install hooks:
196 # f951 is installed elsewhere as part of $(COMPILERS).
197
198 # Install the driver program as $(target)-gfortran
199 # and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
200 fortran.install-common: install-finclude-dir installdirs
201         -if [ -f f951$(exeext) ] ; then \
202           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
203           $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
204           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
205           if [ -f gfortran-cross$(exeext) ] ; then \
206             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
207               rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
208               $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
209             else true; fi; \
210           else \
211             rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
212             $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
213           fi ; \
214         fi
215
216 fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
217
218 fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
219
220 $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
221                 installdirs
222         -rm -f $@
223         -$(INSTALL_DATA) $< $@
224         -chmod a-x $@
225
226 fortran.uninstall:
227         if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
228           echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
229           install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
230         else : ; fi; \
231         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
232         rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
233         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
234         rm -rf $(DESTDIR)$(infodir)/gfortran.info*
235
236 #\f
237 # Clean hooks:
238 # A lot of the ancillary files are deleted by the main makefile.
239 # We just have to delete files specific to us.
240
241 fortran.mostlyclean:
242         -rm -f f951$(exeext)
243         -rm -f fortran/*.o
244
245 fortran.clean:
246 fortran.distclean:
247         -rm -f fortran/config.status fortran/Makefile
248
249 fortran.extraclean:
250 fortran.maintainer-clean:
251         -rm -f doc/gfortran.info* fortran/gfortran.*aux
252         -rm -f $(docobjdir)/gfortran.1
253
254 #\f
255 # Stage hooks:
256 # The toplevel makefile has already created stage?/fortran at this point.
257
258 fortran.stage1: stage1-start
259         -mv fortran/*$(objext) stage1/fortran
260 fortran.stage2: stage2-start
261         -mv fortran/*$(objext) stage2/fortran
262 fortran.stage3: stage3-start
263         -mv fortran/*$(objext) stage3/fortran
264 fortran.stage4: stage4-start
265         -mv fortran/*$(objext) stage4/fortran
266 fortran.stageprofile: stageprofile-start
267         -mv fortran/*$(objext) stageprofile/fortran
268 fortran.stagefeedback: stageprofile-start
269         -mv fortran/*$(objext) stagefeedback/fortran
270
271 #\f
272 # .o: .h dependencies.
273
274 # Everything depends on gfortran.h, but only a few files depend on
275 # the other headers.  So at some point we'll have to split out
276 # which objects depend on what.  FIXME
277 # TODO: Add dependencies on the backend/tree header files
278
279 $(F95_PARSER_OBJS): fortran/gfortran.h fortran/intrinsic.h fortran/match.h \
280                 fortran/parse.h \
281                 $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
282                 $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
283                 $(FLAGS_H) output.h $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) 
284 fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
285
286 GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/intrinsic.h fortran/trans-array.h \
287     fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
288     fortran/trans-stmt.h fortran/trans-types.h \
289     $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
290
291 fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
292   gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) \
293   $(BUILTINS_DEF) fortran/types.def
294 fortran/scanner.o: toplev.h
295 fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
296 fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
297 fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
298   $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
299   $(TREE_DUMP_H)
300 fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
301   $(REAL_H) toplev.h $(TARGET_H)
302 fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
303 fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
304 fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
305 fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS)
306 fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
307   fortran/ioparm.def
308 fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
309 fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
310   gt-fortran-trans-intrinsic.h
311 fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
312 fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
313 fortran/resolve.o: fortran/dependency.h
314 fortran/options.o: $(PARAMS_H) $(TARGET_H)