OSDN Git Service

622892823ed42dcf480791f3d11622190a4baebe
[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 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.info
29 # foo.install-common, foo.install-info, foo.install-man,
30 # foo.uninstall,
31 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
32 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
33 #
34 # where `foo' is the name of the language.
35 #
36 # It should also provide rules for:
37 #
38 # - making any compiler driver (eg: gfortran)
39 # - the compiler proper (eg: f951)
40 # - define the names for selecting the language in LANGUAGES.
41 # $(srcdir) must be set to the gcc/ source directory (*not* gcc/fortran/).
42
43 # Actual name to use when installing a native compiler.
44 GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)')
45 GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)')
46
47 #^L
48
49 # Use strict warnings for this front end.
50 fortran-warn = $(STRICT_WARN)
51
52 # These files get warnings from an inline function in GMP saying:
53 # "control may reach end of non-void function '__gmpz_get_ui' being inlined"
54 fortran/expr.o-warn = -Wno-error
55 fortran/resolve.o-warn = -Wno-error
56 fortran/simplify.o-warn = -Wno-error
57 fortran/trans-common.o-warn = -Wno-error
58
59 # These are the groups of object files we have.  The F95_PARSER_OBJS are
60 # all the front end files, the F95_OBJS are the files for the translation
61 # from the parse tree to GENERIC
62
63 F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
64     fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o \
65     fortran/error.o fortran/expr.o fortran/interface.o \
66     fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
67     fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
68     fortran/options.o fortran/parse.o fortran/primary.o fortran/resolve.o \
69     fortran/scanner.o fortran/simplify.o fortran/st.o 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-stmt.o \
76     fortran/trans-types.o
77
78 # GFORTRAN uses GMP for its internal arithmetics.
79 F95_LIBS = $(GMPLIBS) $(LIBS)
80
81 #\f
82 # Define the names for selecting gfortran in LANGUAGES.
83 FORTRAN fortran: f951$(exeext)
84
85 # Tell GNU make to ignore files by these names if they exist.
86 .PHONY: F95 f95
87
88 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H)
89         (SHLIB_LINK='$(SHLIB_LINK)' \
90         SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
91         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
92                 $(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
93
94 # Create the compiler driver gfortran.
95 GFORTRAN_D_OBJS = gcc.o gfortranspec.o version.o prefix.o intl.o
96 gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
97         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
98           $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
99
100 # Create a version of the gfortran driver which calls the cross-compiler.
101 gfortran-cross$(exeext): gfortran$(exeext)
102         -rm -f gfortran-cross$(exeext)
103         cp gfortran$(exeext) gfortran-cross$(exeext)
104
105 # The compiler itself is called f951.
106 f951$(exeext): $(F95_OBJS) \
107                 $(BACKEND) $(LIBDEPS)
108         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
109                 $(F95_OBJS) $(BACKEND) $(F95_LIBS)
110
111 gt-fortran-trans.h    : s-gtype; @true
112 #\f
113 # Build hooks:
114
115 fortran.all.cross: gfortran-cross$(exeext)
116
117 fortran.start.encap: gfortran$(exeext)
118 fortran.rest.encap:
119
120 fortran.srcinfo: doc/gfortran.info
121         -cp -p $^ $(srcdir)/fortran
122
123 fortran.tags: force
124         cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
125         etags --include TAGS.sub --include ../TAGS.sub
126
127 fortran.info: doc/gfortran.info
128 dvi:: doc/gfortran.dvi
129 html:: $(htmldir)/gfortran/index.html
130
131 F95_MANFILES = doc/gfortran.1
132
133 fortran.man: $(F95_MANFILES)
134
135 fortran.srcman: $(F95_MANFILES)
136         -cp -p $^ $(srcdir)/doc
137
138 fortran.srcextra:
139
140 check-f95 : check-gfortran
141 check-fortran : check-gfortran
142 lang_checks += check-gfortran
143
144 # GFORTRAN documentation.
145 GFORTRAN_TEXI = \
146   $(srcdir)/fortran/gfortran.texi \
147   $(srcdir)/fortran/invoke.texi \
148   $(srcdir)/doc/include/fdl.texi \
149   $(srcdir)/doc/include/gpl.texi \
150   $(srcdir)/doc/include/funding.texi \
151   $(srcdir)/doc/include/gcc-common.texi \
152   gcc-vers.texi
153
154 doc/gfortran.info: $(GFORTRAN_TEXI)
155         if [ x$(BUILD_INFO) = xinfo ]; then \
156           rm -f doc/gfortran.info-*; \
157           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
158             -o $@ $<; \
159         else true; fi
160
161 doc/gfortran.dvi: $(GFORTRAN_TEXI)
162         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
163
164 $(htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
165         $(mkinstalldirs) $(@D)
166         rm -f $(@D)/*
167         $(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/fortran -o $(@D) $<
168
169 .INTERMEDIATE: gfortran.pod
170
171 gfortran.pod: $(GFORTRAN_TEXI)
172         -$(TEXI2POD) < $(srcdir)/fortran/invoke.texi > $@
173
174 #\f
175 # Install hooks:
176 # f951 is installed elsewhere as part of $(COMPILERS).
177
178 # Install the driver program as $(target)-gfortran
179 # and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
180 fortran.install-common: installdirs
181         -if [ -f f951$(exeext) ] ; then \
182           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
183           $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
184           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
185           if [ -f gfortran-cross$(exeext) ] ; then \
186             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
187               rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
188               $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
189             else true; fi; \
190           else \
191             rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
192             $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
193           fi ; \
194         fi
195
196 install-info:: $(DESTDIR)$(infodir)/gfortran.info
197
198 fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
199
200 $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
201                 installdirs
202         -rm -f $@
203         -$(INSTALL_DATA) $< $@
204         -chmod a-x $@
205
206 fortran.uninstall:
207         if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
208           echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
209           install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
210         else : ; fi; \
211         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
212         rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
213         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
214         rm -rf $(DESTDIR)$(infodir)/gfortran.info*
215
216 #\f
217 # Clean hooks:
218 # A lot of the ancillary files are deleted by the main makefile.
219 # We just have to delete files specific to us.
220
221 fortran.mostlyclean:
222         -rm -f f951$(exeext)
223         -rm -f fortran/*.o
224
225 fortran.clean:
226 fortran.distclean:
227         -rm -f fortran/config.status fortran/Makefile
228
229 fortran.extraclean:
230 fortran.maintainer-clean:
231         -rm -f doc/gfortran.info* fortran/gfortran.*aux
232         -rm -f $(docobjdir)/gfortran.1
233
234 #\f
235 # Stage hooks:
236 # The toplevel makefile has already created stage?/fortran at this point.
237
238 fortran.stage1: stage1-start
239         -mv fortran/*$(objext) stage1/fortran
240 fortran.stage2: stage2-start
241         -mv fortran/*$(objext) stage2/fortran
242 fortran.stage3: stage3-start
243         -mv fortran/*$(objext) stage3/fortran
244 fortran.stage4: stage4-start
245         -mv fortran/*$(objext) stage4/fortran
246 fortran.stageprofile: stageprofile-start
247         -mv fortran/*$(objext) stageprofile/fortran
248 fortran.stagefeedback: stageprofile-start
249         -mv fortran/*$(objext) stagefeedback/fortran
250
251 #\f
252 # .o: .h dependencies.
253
254 # Everything depends on gfortran.h, but only a few files depend on
255 # the other headers.  So at some point we'll have to split out
256 # which objects depend on what.  FIXME
257 # TODO: Add dependencies on the backend/tree header files
258
259 $(F95_PARSER_OBJS): fortran/gfortran.h fortran/intrinsic.h fortran/match.h \
260                 fortran/parse.h \
261                 $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
262                 $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
263                 flags.h output.h diagnostic.h errors.h function.h 
264
265 GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/intrinsic.h fortran/trans-array.h \
266     fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
267     fortran/trans-stmt.h fortran/trans-types.h \
268     $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
269
270 fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
271   gt-fortran-f95-lang.h gtype-fortran.h cgraph.h $(TARGET_H)
272 fortran/scanner.o: toplev.h
273 fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
274 fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
275 fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
276   cgraph.h $(TARGET_H) function.h $(FLAGS_H) tree-gimple.h \
277   tree-dump.h
278 fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
279   real.h toplev.h $(TARGET_H)
280 fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
281 fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
282 fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS)
283 fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
284   fortran/ioparm.def
285 fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
286 fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
287   gt-fortran-trans-intrinsic.h
288 fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
289 fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS)
290 fortran/resolve.o: fortran/dependency.h
291