aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/Make-lang.in
blob: 29b41920899b96d929283bf1df337119b448225a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# -*- makefile -*-
# Top level makefile fragment for GNU gfortran, the GNU Fortran 95 compiler.
# Copyright (C) 2002, 2003, 2004, 2005 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 2, 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 COPYING.  If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.

# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.info
# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
# foo.uninstall, foo.distdir,
# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
# 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)')

# Actual name to use when installing a cross-compiler.
GFORTRAN_CROSS_NAME := $(shell echo gfortran|sed '$(program_transform_cross_name)')

#^L

# Use strict warnings for this front end.
fortran-warn = $(STRICT_WARN)

# These files get warnings from an inline function in GMP saying:
# "control may reach end of non-void function '__gmpz_get_ui' being inlined"
fortran/expr.o-warn = -Wno-error
fortran/resolve.o-warn = -Wno-error
fortran/simplify.o-warn = -Wno-error
fortran/trans-common.o-warn = -Wno-error

# 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/options.o fortran/parse.o fortran/primary.o fortran/resolve.o \
    fortran/scanner.o fortran/simplify.o fortran/st.o fortran/symbol.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-stmt.o \
    fortran/trans-types.o

# GFORTRAN uses GMP for its internal arithmetics.
F95_LIBS = $(GMPLIBS) $(LIBS)

#
# Define the names for selecting gfortran in LANGUAGES.
F95 f95: f951$(exeext)

# Tell GNU make to ignore files by these names if they exist.
.PHONY: F95 f95

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.o 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)
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
		$(F95_OBJS) $(BACKEND) $(F95_LIBS)

gt-fortran-f95-lang.h gtype-fortran.h	      : s-gtype; @true
gt-fortran-trans-decl.h gt-fortran-trans.h    : s-gtype; @true
gt-fortran-trans-io.h gt-fortran-trans-types.h: s-gtype; @true
gt-fortran-trans-intrinsic.h		      : s-gtype; @true

#
# Build hooks:

f95.all.build: gfortran$(exeext)
f95.all.cross: gfortran-cross$(exeext)

f95.start.encap: gfortran$(exeext)
f95.rest.encap:

f95.srcinfo: doc/gfortran.info
	-cp -p $^ $(srcdir)/fortran

f95.tags: force
	cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \
	etags --include TAGS.sub --include ../TAGS.sub

f95.info: doc/gfortran.info
dvi:: doc/gfortran.dvi
html:: $(htmldir)/gfortran/index.html

F95_MANFILES = doc/gfortran.1

f95.man: $(F95_MANFILES)

f95.srcman: $(F95_MANFILES)
	-cp -p $^ $(srcdir)/doc

f95.srcextra:

check-f95 : check-gfortran
lang_checks += check-gfortran

# GFORTRAN documentation.
GFORTRAN_TEXI = \
  $(srcdir)/fortran/gfortran.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 $@ $<

$(htmldir)/gfortran/index.html: $(GFORTRAN_TEXI)
	$(mkinstalldirs) $(@D)
	rm -f $(@D)/*
	$(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/fortran -o $(@D) $<

.INTERMEDIATE: gfortran.pod

gfortran.pod: $(GFORTRAN_TEXI)
	-$(TEXI2POD) < $(srcdir)/fortran/invoke.texi > $@

#
# Install hooks:
# f951 is installed elsewhere as part of $(COMPILERS).

# Nothing to do here.
f95.install-normal:

# Install the driver program as $(target)-gfortran
# and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
f95.install-common: installdirs
	-if [ -f f951$(exeext) ] ; then \
	  if [ -f gfortran-cross$(exeext) ] ; then \
	    rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
	    $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
	    chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_CROSS_NAME)$(exeext); \
	    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_INSTALL_NAME)$(exeext); \
	    $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
	    chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
	    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

install-info:: $(DESTDIR)$(infodir)/gfortran.info

f95.install-man: installdirs \
	$(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext)

$(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1
	-rm -f $@
	-$(INSTALL_DATA) $< $@
	-chmod a-x $@

f95.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_CROSS_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.

f95.mostlyclean:
	-rm -f f951$(exeext)
	-rm -f fortran/*.o

f95.clean:
f95.distclean:
	-rm -f fortran/config.status fortran/Makefile

f95.extraclean:
f95.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.

f95.stage1: stage1-start
	-mv fortran/*$(objext) stage1/fortran
f95.stage2: stage2-start
	-mv fortran/*$(objext) stage2/fortran
f95.stage3: stage3-start
	-mv fortran/*$(objext) stage3/fortran
f95.stage4: stage4-start
	-mv fortran/*$(objext) stage4/fortran
f95.stageprofile: stageprofile-start
	-mv fortran/*$(objext) stageprofile/fortran
f95.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/intrinsic.h fortran/match.h \
		fortran/parse.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 

GFORTRAN_TRANS_DEPS = fortran/gfortran.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) function.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 errors.h $(FLAGS_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)
fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h
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: fortran/gfortran.h fortran/dependency.h
fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS)