]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/Make-lang.in
Merge tree-ssa-20020619-branch into mainline.
[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, 2003 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 G95.
8
9 #G95 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 #G95 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 G95; see the file COPYING. If not, write to
21 #the Free Software Foundation, 59 Temple Place - Suite 330,
22 #Boston, MA 02111-1307, 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.build, foo.all.cross, foo.start.encap, foo.rest.encap,
28 # foo.info, foo.dvi,
29 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
30 # foo.uninstall, foo.distdir,
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 = `echo gfortran|sed '$(program_transform_name)'`
45
46 # Actual name to use when installing a cross-compiler.
47 GFORTRAN_CROSS_NAME = `echo gfortran|sed '$(program_transform_cross_name)'`
48
49 #^L
50
51 # This is in addition to the warning flags defined by default.
52 # You can use it to enable/disable warnings globally or for specific
53 # files, e.g.
54 # fortran-warn = -Wno-strict-prototypes
55 # fortran/arith.o-warn = -Wno-error
56 #
57 # We don't need these cheats, everything builds fine with all warnings
58 # enabled and -Werror.
59
60 # These are the groups of object files we have. The F95_PARSER_OBJS are
61 # all the front end files, the F95_OBJS are the files for the translation
62 # from the parse tree to GENERIC, and F95_ADDITIONAL_OBJS are the files
63 # from the middle end we depend on.
64
65 F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o fortran/check.o\
66 fortran/decl.o fortran/error.o fortran/expr.o fortran/interface.o \
67 fortran/intrinsic.o fortran/io.o fortran/iresolve.o fortran/match.o \
68 fortran/matchexp.o fortran/misc.o fortran/module.o fortran/parse.o \
69 fortran/primary.o fortran/options.o fortran/resolve.o \
70 fortran/scanner.o fortran/simplify.o fortran/st.o fortran/symbol.o \
71 fortran/dump-parse-tree.o
72
73 F95_OBJS = $(F95_PARSER_OBJS) \
74 fortran/f95-lang.o fortran/convert.o fortran/trans.o fortran/trans-decl.o \
75 fortran/trans-types.o fortran/trans-const.o fortran/trans-expr.o \
76 fortran/trans-stmt.o fortran/trans-io.o fortran/trans-array.o \
77 fortran/trans-intrinsic.o fortran/dependency.o fortran/trans-common.o \
78 fortran/data.o
79
80 # FIXME:
81 # We rely on c-semantics to expand from GIMPLE to RTL.
82 # This should go away once a real GIMPLE expander is available.
83 F95_ADDITIONAL_OBJS = \
84 tree-cfg.o tree-dfa.o tree-optimize.o tree-simple.o \
85 tree-ssa.o tree-ssa-ccp.o tree-ssa-dce.o \
86 tree-alias-common.o tree-alias-type.o gimplify.o stor-layout.o
87
88 # GFORTRAN uses GMP for its internal arithmetics.
89 F95_LIBS = $(GMPLIBS) $(LIBS)
90
91 #\f
92 # Define the names for selecting gfortran in LANGUAGES.
93 F95 f95: f951$(exeext)
94
95 # Tell GNU make to ignore files by these names if they exist.
96 .PHONY: F95 f95
97
98 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H)
99 (SHLIB_LINK='$(SHLIB_LINK)' \
100 SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
101 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
102 $(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
103
104 # Create the compiler driver gfortran.
105 GFORTRAN_D_OBJS = gcc.o gfortranspec.o version.o prefix.o intl.o
106 gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
107 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
108 $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
109
110 # Create a version of the gfortran driver which calls the cross-compiler.
111 gfortran-cross$(exeext): gfortran$(exeext)
112 -rm -f gfortran-cross$(exeext)
113 cp gfortran$(exeext) gfortran-cross$(exeext)
114
115 # The compiler itself is called f951.
116 f951$(exeext): $(F95_OBJS) $(F95_ADDITIONAL_OBJS) \
117 $(BACKEND) $(LIBDEPS)
118 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
119 $(F95_OBJS) $(F95_ADDITIONAL_OBJS) $(BACKEND) $(F95_LIBS)
120
121 gt-fortran-f95-lang.h gtype-fortran.h : s-gtype; @true
122 gt-fortran-trans-decl.h gt-fortran-trans.h : s-gtype; @true
123 gt-fortran-trans-io.h gt-fortran-trans-types.h: s-gtype; @true
124 gt-fortran-trans-intrinsic.h : s-gtype; @true
125
126 #\f
127 # Build hooks:
128
129 f95.all.build: gfortran$(exeext)
130 f95.all.cross: gfortran-cross$(exeext)
131
132 f95.start.encap: gfortran$(exeext)
133 f95.rest.encap:
134
135 f95.srcinfo: fortran/gfortran.info
136 -cp -p $^ $(srcdir)/fortran
137
138 f95.tags: force
139 cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
140 etags --include TAGS.sub --include ../TAGS.sub
141
142 f95.info: fortran/gfortran.info
143 f95.dvi: fortran/gfortran.dvi
144 f95.generated-manpages:
145
146 f95.man:
147 f95.srcman:
148
149 check-f95 : check-gfortran
150 lang_checks += check-gfortran
151
152 # GFORTRAN documentation.
153 GFORTRAN_TEXI = \
154 $(srcdir)/fortran/gfortran.texi \
155 $(srcdir)/fortran/invoke.texi \
156 $(srcdir)/doc/include/fdl.texi \
157 $(srcdir)/doc/include/gpl.texi \
158 $(srcdir)/doc/include/funding.texi \
159 $(srcdir)/doc/include/gcc-common.texi
160
161 fortran/gfortran.info: $(GFORTRAN_TEXI)
162 if [ x$(BUILD_INFO) = xinfo ]; then \
163 rm -f fortran/gfortran.info-*; \
164 $(MAKEINFO) -I$(srcdir)/doc/include -I$(srcdir)/fortran \
165 -o fortran/gfortran.info $(srcdir)/fortran/gfortran.texi; \
166 else true; fi
167
168 fortran/gfortran.dvi: $(GFORTRAN_TEXI)
169 s=`cd $(srcdir); ${PWD}`; export s; \
170 cd fortran && $(TEXI2DVI) -I $$s/doc/include -I $$s/fortran \
171 $$s/fortran/gfortran.texi
172
173 #\f
174 # Install hooks:
175 # f951 is installed elsewhere as part of $(COMPILERS).
176
177 # Nothing to do here.
178 f95.install-normal:
179
180 # Install the driver program as $(target)-gfortran
181 # and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
182 f95.install-common: installdirs
183 -if [ -f f951$(exeext) ] ; then \
184 if [ -f gfortran-cross$(exeext) ] ; then \
185 rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
186 $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
187 chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
188 if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
189 rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
190 $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
191 else true; fi; \
192 else \
193 rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
194 $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
195 chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
196 rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
197 $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
198 fi ; \
199 fi
200
201 # Install the info documentation in $(infodir).
202 # Taken from G77 (but then, what is not...)
203 f95.install-info: f95.info installdirs
204 if [ -f fortran/gfortran.info ] ; then \
205 rm -f $(DESTDIR)$(infodir)/gfortran.info*; \
206 for f in fortran/gfortran.info*; do \
207 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
208 $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \
209 done; \
210 chmod a-x $(DESTDIR)$(infodir)/gfortran.info*; \
211 else true; fi
212 @if [ -f fortran/gfortran.info ] ; then \
213 if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
214 echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
215 install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
216 else : ; fi; \
217 else : ; fi
218
219 f95.install-man: installdirs
220 #TODO: write the gfortran man pages
221
222 f95.uninstall:
223 if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
224 echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
225 install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
226 else : ; fi; \
227 rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
228 rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
229 rm -rf $(DESTDIR)$(infodir)/gfortran.info*
230
231 #\f
232 # Clean hooks:
233 # A lot of the ancillary files are deleted by the main makefile.
234 # We just have to delete files specific to us.
235
236 f95.mostlyclean:
237 -rm -f f951$(exeext)
238 -rm -f fortran/*.o
239
240 f95.clean:
241 f95.distclean:
242 -rm -f fortran/config.status fortran/Makefile
243
244 f95.extraclean:
245 f95.maintainer-clean:
246 -rm -f fortran/gfortran.info* fortran/gfortran.*aux
247
248 #\f
249 # Stage hooks:
250 # The toplevel makefile has already created stage?/fortran at this point.
251
252 f95.stage1: stage1-start
253 -mv fortran/*$(objext) stage1/fortran
254 f95.stage2: stage2-start
255 -mv fortran/*$(objext) stage2/fortran
256 f95.stage3: stage3-start
257 -mv fortran/*$(objext) stage3/fortran
258 f95.stage4: stage4-start
259 -mv fortran/*$(objext) stage4/fortran
260 f95.stageprofile: stageprofile-start
261 -mv fortran/*$(objext) stageprofile/fortran
262 f95.stagefeedback: stageprofile-start
263 -mv fortran/*$(objext) stagefeedback/fortran
264
265 #\f
266 # .o: .h dependencies.
267
268 # Everything depends on gfortran.h, but only a few files depend on
269 # the other headers. So at some point we'll have to split out
270 # which objects depend on what. FIXME
271 # TODO: Add dependencies on the backend/tree header files
272
273 $(F95_PARSER_OBJS): fortran/gfortran.h fortran/intrinsic.h fortran/match.h \
274 fortran/parse.h \
275 $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
276 $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
277 flags.h output.h diagnostic.h errors.h function.h
278
279 GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/intrinsic.h fortran/trans-array.h \
280 fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
281 fortran/trans-stmt.h fortran/trans-types.h \
282 $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h
283
284 fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
285 gt-fortran-f95-lang.h gtype-fortran.h cgraph.h
286 fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
287 fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
288 fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h cgraph.h
289 fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h
290 fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
291 fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS)
292 fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS)
293 fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h
294 fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
295 fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
296 gt-fortran-trans-intrinsic.h
297 fortran/dependency.o: fortran/gfortran.h fortran/dependency.h
298 fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) fortran/gfortran.h
299 fortran/data.c: $(GFORTRAN_TRANS_DEPS)
300