Fix ChangeLog
[official-gcc.git] / gcc / fortran / Make-lang.in
blob6acdbbefd7bf82136a22e2707037a78c130f15e1
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 Free Software
4 # Foundation, Inc.
5 # Contributed by Paul Brook <paul@nowt.org
6 # and Steven Bosscher <s.bosscher@student.tudelft.nl>
8 #This file is part of GCC.
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.
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.
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/>.
24 # This file provides the language dependent support in the main Makefile.
25 # Each language makefile fragment must provide the following targets:
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
33 # where `foo' is the name of the language.
35 # It should also provide rules for:
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/).
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)')
46 #^L
48 # Use strict warnings for this front end.
49 fortran-warn = $(STRICT_WARN)
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
55 F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
56     fortran/check.o fortran/cpp.o fortran/data.o fortran/decl.o \
57     fortran/dump-parse-tree.o fortran/error.o fortran/expr.o \
58     fortran/interface.o fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
59     fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
60     fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \
61     fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \
62     fortran/symbol.o fortran/target-memory.o
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
71 fortran_OBJS = $(F95_OBJS) gfortranspec.o
73 #\f
74 # Define the names for selecting gfortran in LANGUAGES.
75 fortran: f951$(exeext)
77 # Tell GNU make to ignore files by these names if they exist.
78 .PHONY: fortran
80 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H)
81         (SHLIB_LINK='$(SHLIB_LINK)'; \
82         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
83                 $(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
85 # Create the compiler driver gfortran.
86 GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o version.o prefix.o intl.o
87 gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
88         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
89           $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
91 # Create a version of the gfortran driver which calls the cross-compiler.
92 gfortran-cross$(exeext): gfortran$(exeext)
93         -rm -f gfortran-cross$(exeext)
94         cp gfortran$(exeext) gfortran-cross$(exeext)
96 # The compiler itself is called f951.
97 f951$(exeext): $(F95_OBJS) \
98                 $(BACKEND) $(LIBDEPS) attribs.o
99         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
100                 $(F95_OBJS) $(BACKEND) $(LIBS) attribs.o $(GMPLIBS)
102 gt-fortran-trans.h    : s-gtype; @true
104 # Build hooks:
106 fortran.all.cross: gfortran-cross$(exeext)
108 fortran.start.encap: gfortran$(exeext)
109 fortran.rest.encap:
111 fortran.srcinfo: doc/gfortran.info
112         -cp -p $^ $(srcdir)/fortran
114 fortran.tags: force
115         cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
116         etags --include TAGS.sub --include ../TAGS.sub
118 fortran.info: doc/gfortran.info doc/gfc-internals.info
119 fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi
120 fortran.html: $(build_htmldir)/gfortran/index.html
122 F95_PDFFILES = doc/gfortran.pdf
124 fortran.pdf: $(F95_PDFFILES) doc/gfc-internals.pdf
126 fortran.install-pdf: $(F95_PDFFILES)
127         @$(NORMAL_INSTALL)
128         test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
129         @list='$(F95_PDFFILES)'; for p in $$list; do \
130           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
131           f=$(pdf__strip_dir) \
132           echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
133           $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
134         done
136 F95_MANFILES = doc/gfortran.1
138 fortran.man: $(F95_MANFILES)
140 fortran.srcman: $(F95_MANFILES)
141         -cp -p $^ $(srcdir)/doc
143 fortran.srcextra:
145 check-f95 : check-gfortran
146 check-fortran : check-gfortran
147 lang_checks += check-gfortran
149 # GFORTRAN documentation.
150 GFORTRAN_TEXI = \
151   $(srcdir)/fortran/gfortran.texi \
152   $(srcdir)/fortran/intrinsic.texi \
153   $(srcdir)/fortran/invoke.texi \
154   $(srcdir)/doc/include/fdl.texi \
155   $(srcdir)/doc/include/gpl_v3.texi \
156   $(srcdir)/doc/include/funding.texi \
157   $(srcdir)/doc/include/gcc-common.texi \
158   gcc-vers.texi
160 doc/gfortran.info: $(GFORTRAN_TEXI)
161         if [ x$(BUILD_INFO) = xinfo ]; then \
162           rm -f doc/gfortran.info-*; \
163           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
164             -o $@ $<; \
165         else true; fi
167 doc/gfortran.dvi: $(GFORTRAN_TEXI)
168         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
170 doc/gfortran.pdf: $(GFORTRAN_TEXI)
171         $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
173 $(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
174         $(mkinstalldirs) $(@D)
175         rm -f $(@D)/*
176         $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $<
178 .INTERMEDIATE: gfortran.pod
180 gfortran.pod: $(GFORTRAN_TEXI)
181         -$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" \
182           < $(srcdir)/fortran/invoke.texi > $@
184 # GFORTRAN internals documentation.
185 GFC_INTERNALS_TEXI = \
186   $(srcdir)/fortran/gfc-internals.texi \
187   $(srcdir)/doc/include/fdl.texi \
188   $(srcdir)/doc/include/gcc-common.texi \
189   gcc-vers.texi
191 doc/gfc-internals.info: $(GFC_INTERNALS_TEXI)
192         if [ x$(BUILD_INFO) = xinfo ]; then \
193           rm -f doc/gfc-internals.info-*; \
194           $(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
195             -o $@ $<; \
196         else true; fi
198 doc/gfc-internals.dvi: $(GFC_INTERNALS_TEXI)
199         $(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
201 doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI)
202         $(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
204 # Create or recreate the gfortran private include file directory.
205 install-finclude-dir: installdirs
206         -rm -rf $(DESTDIR)$(libsubdir)/finclude
207         mkdir $(DESTDIR)$(libsubdir)/finclude
208         -chmod a+rx $(DESTDIR)$(libsubdir)/finclude
210 # Install hooks:
211 # f951 is installed elsewhere as part of $(COMPILERS).
213 # Install the driver program as $(target)-gfortran
214 # and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
215 fortran.install-common: install-finclude-dir installdirs
216         -if [ -f f951$(exeext) ] ; then \
217           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
218           $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
219           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
220           if [ -f gfortran-cross$(exeext) ] ; then \
221             if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
222               rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
223               $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
224             else true; fi; \
225           else \
226             rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
227             $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
228           fi ; \
229         fi
231 fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
233 fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
235 $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
236                 installdirs
237         -rm -f $@
238         -$(INSTALL_DATA) $< $@
239         -chmod a-x $@
241 fortran.uninstall:
242         if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
243           echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
244           install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
245         else : ; fi; \
246         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
247         rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
248         rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
249         rm -rf $(DESTDIR)$(infodir)/gfortran.info*
252 # Clean hooks:
253 # A lot of the ancillary files are deleted by the main makefile.
254 # We just have to delete files specific to us.
256 fortran.mostlyclean:
257         -rm -f f951$(exeext)
258         -rm -f fortran/*.o
260 fortran.clean:
261 fortran.distclean:
262         -rm -f fortran/config.status fortran/Makefile
264 fortran.extraclean:
265 fortran.maintainer-clean:
266         -rm -f doc/gfortran.info* fortran/gfortran.*aux
267         -rm -f $(docobjdir)/gfortran.1
270 # Stage hooks:
271 # The toplevel makefile has already created stage?/fortran at this point.
273 fortran.stage1: stage1-start
274         -mv fortran/*$(objext) stage1/fortran
275 fortran.stage2: stage2-start
276         -mv fortran/*$(objext) stage2/fortran
277 fortran.stage3: stage3-start
278         -mv fortran/*$(objext) stage3/fortran
279 fortran.stage4: stage4-start
280         -mv fortran/*$(objext) stage4/fortran
281 fortran.stageprofile: stageprofile-start
282         -mv fortran/*$(objext) stageprofile/fortran
283 fortran.stagefeedback: stageprofile-start
284         -mv fortran/*$(objext) stagefeedback/fortran
287 # .o: .h dependencies.
289 # Everything depends on gfortran.h, but only a few files depend on
290 # the other headers.  So at some point we'll have to split out
291 # which objects depend on what.  FIXME
292 # TODO: Add dependencies on the backend/tree header files
294 $(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
295                 fortran/intrinsic.h fortran/match.h \
296                 fortran/parse.h fortran/arith.h fortran/target-memory.h \
297                 $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
298                 $(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
299                 $(FLAGS_H) output.h $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) 
300 fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
302 GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
303     fortran/intrinsic.h fortran/trans-array.h \
304     fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
305     fortran/trans-stmt.h fortran/trans-types.h \
306     $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
308 fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
309   gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) fortran/cpp.h \
310   $(BUILTINS_DEF) fortran/types.def
311 fortran/scanner.o: toplev.h fortran/cpp.h
312 fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
313 fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
314 fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
315   $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
316   $(TREE_DUMP_H)
317 fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
318   $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) dwarf2out.h
319 fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
320 fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
321 fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
322 fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS)
323 fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
324   fortran/ioparm.def
325 fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
326 fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
327   gt-fortran-trans-intrinsic.h
328 fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
329 fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
330 fortran/resolve.o: fortran/dependency.h fortran/data.h fortran/target-memory.h
331 fortran/data.o: fortran/data.h
332 fortran/options.o: $(PARAMS_H) $(TARGET_H) fortran/cpp.h
333 fortran/cpp.o: fortran/cpp.c $(BASEVER) incpath.h incpath.o
334         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) -DBASEVER=$(BASEVER_s) \
335                 $< $(OUTPUT_OPTION)