8sa1-gcc/gcc/fortran/Make-lang.in
Francois-Xavier Coudert d74b97cc7e re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675

	* libgfortran.h: New file.
	* iso-fortran-env.def: Use macros in the new header instead of
	hardcoded integer constants.
	* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
	fortran/libgfortran.h.
	* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
	ioerror_codes): Remove.
	* trans.c (ERROR_ALLOCATION): Remove.
	(gfc_call_malloc, gfc_allocate_with_status,
	gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
	* trans-types.h (GFC_DTYPE_*): Remove.
	* trans-decl.c (gfc_generate_function_code): Use
	GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
	* trans-io.c (set_parameter_value, set_parameter_ref): Use
	LIBERROR_* macros instead of IOERROR_ macros.
	* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
	LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
	* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
	CONVERT_NATIVE.
	(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.

	* libgfortran.h: Include gcc/fortran/libgfortran.h.
	Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
	error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
	* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
	of hardcoded constants.
	(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
	CONVERT_*.
	* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
	of ERROR_BAD_OPTION.
	* runtime/error.c (translate_error, generate_error): Use
	LIBERROR_* macros instead of ERROR_*.
	* io/file_pos.c (formatted_backspace, unformatted_backspace,
	st_backspace, st_rewind, st_flush): Rename macros.
	* io/open.c (convert_opt, edit_modes, new_unit, already_open,
	st_open): Likewise.
	* io/close.c (st_close): Likewise.
	* io/list_read.c (next_char, convert_integer, parse_repeat,
	read_logical, read_integer, read_character, parse_real,
	check_type, list_formatted_read_scalar, namelist_read,
	nml_err_ret): Likewise.
	* io/read.c (convert_real, read_l, read_decimal, read_radix,
	read_f): Likewise.
	* io/inquire.c (inquire_via_unit): Likewise.
	* io/unit.c (get_internal_unit): Likewise.
	* io/transfer.c (read_sf, read_block, read_block_direct,
	write_block, write_buf, unformatted_read, unformatted_write,
	formatted_transfer_scalar, us_read, us_write, data_transfer_init,
	skip_record, next_record_r, write_us_marker, next_record_w_unf,
	next_record_w, finalize_transfer, st_read, st_write_done):
	Likewise.
	* io/format.c (format_error): Likewise.

From-SVN: r128050
2007-09-03 16:44:15 +00:00

330 lines
12 KiB
Makefile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- makefile -*-
# Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# Contributed by Paul Brook <paul@nowt.org
# and Steven Bosscher <s.bosscher@student.tudelft.nl>
#This file is part of GCC.
#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3, or (at your option)
#any later version.
#GCC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GCC; see the file COPYING3. If not see
#<http://www.gnu.org/licenses/>.
# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
# foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
# foo.mostlyclean, foo.clean, foo.distclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: gfortran)
# - the compiler proper (eg: f951)
# - define the names for selecting the language in LANGUAGES.
# $(srcdir) must be set to the gcc/ source directory (*not* gcc/fortran/).
# Actual name to use when installing a native compiler.
GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)')
GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)')
#^L
# Use strict warnings for this front end.
fortran-warn = $(STRICT_WARN)
# These are the groups of object files we have. The F95_PARSER_OBJS are
# all the front end files, the F95_OBJS are the files for the translation
# from the parse tree to GENERIC
F95_PARSER_OBJS = fortran/arith.o fortran/array.o fortran/bbt.o \
fortran/check.o fortran/data.o fortran/decl.o fortran/dump-parse-tree.o \
fortran/error.o fortran/expr.o fortran/interface.o \
fortran/intrinsic.o fortran/io.o fortran/iresolve.o \
fortran/match.o fortran/matchexp.o fortran/misc.o fortran/module.o \
fortran/openmp.o fortran/options.o fortran/parse.o fortran/primary.o \
fortran/resolve.o fortran/scanner.o fortran/simplify.o fortran/st.o \
fortran/symbol.o fortran/target-memory.o
F95_OBJS = $(F95_PARSER_OBJS) \
fortran/convert.o fortran/dependency.o fortran/f95-lang.o \
fortran/trans.o fortran/trans-array.o fortran/trans-common.o \
fortran/trans-const.o fortran/trans-decl.o fortran/trans-expr.o \
fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
fortran/trans-stmt.o fortran/trans-types.o
#
# Define the names for selecting gfortran in LANGUAGES.
fortran: f951$(exeext)
# Tell GNU make to ignore files by these names if they exist.
.PHONY: fortran
gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) $(CONFIG_H)
(SHLIB_LINK='$(SHLIB_LINK)' \
SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
# Create the compiler driver gfortran.
GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o version.o prefix.o intl.o
gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
$(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
# Create a version of the gfortran driver which calls the cross-compiler.
gfortran-cross$(exeext): gfortran$(exeext)
-rm -f gfortran-cross$(exeext)
cp gfortran$(exeext) gfortran-cross$(exeext)
# The compiler itself is called f951.
f951$(exeext): $(F95_OBJS) \
$(BACKEND) $(LIBDEPS) attribs.o
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
$(F95_OBJS) $(BACKEND) $(LIBS) attribs.o
gt-fortran-trans.h : s-gtype; @true
#
# Build hooks:
fortran.all.cross: gfortran-cross$(exeext)
fortran.start.encap: gfortran$(exeext)
fortran.rest.encap:
fortran.srcinfo: doc/gfortran.info
-cp -p $^ $(srcdir)/fortran
fortran.tags: force
cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
etags --include TAGS.sub --include ../TAGS.sub
fortran.info: doc/gfortran.info doc/gfc-internals.info
fortran.dvi: doc/gfortran.dvi doc/gfc-internals.dvi
fortran.html: $(build_htmldir)/gfortran/index.html
F95_PDFFILES = doc/gfortran.pdf
fortran.pdf: $(F95_PDFFILES) doc/gfc-internals.pdf
fortran.install-pdf: $(F95_PDFFILES)
@$(NORMAL_INSTALL)
test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
@list='$(F95_PDFFILES)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(pdf__strip_dir) \
echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
$(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
done
F95_MANFILES = doc/gfortran.1
fortran.man: $(F95_MANFILES)
fortran.srcman: $(F95_MANFILES)
-cp -p $^ $(srcdir)/doc
fortran.srcextra:
check-f95 : check-gfortran
check-fortran : check-gfortran
lang_checks += check-gfortran
# GFORTRAN documentation.
GFORTRAN_TEXI = \
$(srcdir)/fortran/gfortran.texi \
$(srcdir)/fortran/intrinsic.texi \
$(srcdir)/fortran/invoke.texi \
$(srcdir)/doc/include/fdl.texi \
$(srcdir)/doc/include/gpl.texi \
$(srcdir)/doc/include/funding.texi \
$(srcdir)/doc/include/gcc-common.texi \
gcc-vers.texi
doc/gfortran.info: $(GFORTRAN_TEXI)
if [ x$(BUILD_INFO) = xinfo ]; then \
rm -f doc/gfortran.info-*; \
$(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
-o $@ $<; \
else true; fi
doc/gfortran.dvi: $(GFORTRAN_TEXI)
$(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
doc/gfortran.pdf: $(GFORTRAN_TEXI)
$(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
$(build_htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
$(mkinstalldirs) $(@D)
rm -f $(@D)/*
$(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/fortran -o $(@D) $<
.INTERMEDIATE: gfortran.pod
gfortran.pod: $(GFORTRAN_TEXI)
-$(TEXI2POD) -DBUGURL="$(BUGURL_TEXI)" \
< $(srcdir)/fortran/invoke.texi > $@
# GFORTRAN internals documentation.
GFC_INTERNALS_TEXI = \
$(srcdir)/fortran/gfc-internals.texi \
$(srcdir)/doc/include/fdl.texi \
$(srcdir)/doc/include/gcc-common.texi \
gcc-vers.texi
doc/gfc-internals.info: $(GFC_INTERNALS_TEXI)
if [ x$(BUILD_INFO) = xinfo ]; then \
rm -f doc/gfc-internals.info-*; \
$(MAKEINFO) -I $(srcdir)/doc/include -I $(srcdir)/fortran \
-o $@ $<; \
else true; fi
doc/gfc-internals.dvi: $(GFC_INTERNALS_TEXI)
$(TEXI2DVI) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
doc/gfc-internals.pdf: $(GFC_INTERNALS_TEXI)
$(TEXI2PDF) -I $(srcdir)/fortran -I $(abs_docdir)/include -o $@ $<
# Create or recreate the gfortran private include file directory.
install-finclude-dir: installdirs
-rm -rf $(DESTDIR)$(libsubdir)/finclude
mkdir $(DESTDIR)$(libsubdir)/finclude
-chmod a+rx $(DESTDIR)$(libsubdir)/finclude
#
# Install hooks:
# f951 is installed elsewhere as part of $(COMPILERS).
# Install the driver program as $(target)-gfortran
# and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
fortran.install-common: install-finclude-dir installdirs
-if [ -f f951$(exeext) ] ; then \
rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
if [ -f gfortran-cross$(exeext) ] ; then \
if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
$(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
else true; fi; \
else \
rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
$(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
fi ; \
fi
fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
fortran.install-man: $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)
$(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
installdirs
-rm -f $@
-$(INSTALL_DATA) $< $@
-chmod a-x $@
fortran.uninstall:
if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
else : ; fi; \
rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
rm -rf $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext); \
rm -rf $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
rm -rf $(DESTDIR)$(infodir)/gfortran.info*
#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.
fortran.mostlyclean:
-rm -f f951$(exeext)
-rm -f fortran/*.o
fortran.clean:
fortran.distclean:
-rm -f fortran/config.status fortran/Makefile
fortran.extraclean:
fortran.maintainer-clean:
-rm -f doc/gfortran.info* fortran/gfortran.*aux
-rm -f $(docobjdir)/gfortran.1
#
# Stage hooks:
# The toplevel makefile has already created stage?/fortran at this point.
fortran.stage1: stage1-start
-mv fortran/*$(objext) stage1/fortran
fortran.stage2: stage2-start
-mv fortran/*$(objext) stage2/fortran
fortran.stage3: stage3-start
-mv fortran/*$(objext) stage3/fortran
fortran.stage4: stage4-start
-mv fortran/*$(objext) stage4/fortran
fortran.stageprofile: stageprofile-start
-mv fortran/*$(objext) stageprofile/fortran
fortran.stagefeedback: stageprofile-start
-mv fortran/*$(objext) stagefeedback/fortran
#
# .o: .h dependencies.
# Everything depends on gfortran.h, but only a few files depend on
# the other headers. So at some point we'll have to split out
# which objects depend on what. FIXME
# TODO: Add dependencies on the backend/tree header files
$(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
fortran/intrinsic.h fortran/match.h \
fortran/parse.h fortran/arith.h fortran/target-memory.h \
$(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
$(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
$(FLAGS_H) output.h $(DIAGNOSTIC_H) errors.h $(FUNCTION_H)
fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
fortran/intrinsic.h fortran/trans-array.h \
fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
fortran/trans-stmt.h fortran/trans-types.h \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) \
$(BUILTINS_DEF) fortran/types.def
fortran/scanner.o: toplev.h
fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
$(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
$(TREE_DUMP_H)
fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
$(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H)
fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
fortran/ioparm.def
fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
gt-fortran-trans-intrinsic.h
fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
fortran/resolve.o: fortran/dependency.h
fortran/options.o: $(PARAMS_H) $(TARGET_H)