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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
# Make-lang.in -- Top level -*- makefile -*- fragment for the D frontend.
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
# 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.
# Installation name.
D_INSTALL_NAME = $(shell echo gdc|sed '$(program_transform_name)')
D_TARGET_INSTALL_NAME = $(target_noncanonical)-$(shell echo gdc|sed '$(program_transform_name)')
# Name of phobos library
D_LIBPHOBOS = -DLIBPHOBOS=\"gphobos\"
# The name for selecting d in LANGUAGES.
d: d21$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: d
# Create the compiler driver for D.
CFLAGS-d/d-spec.o += $(DRIVER_DEFINES) $(D_LIBPHOBOS)
GDC_OBJS = $(GCC_OBJS) d/d-spec.o
gdc$(exeext): $(GDC_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GDC_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
$(EXTRA_GCC_LIBS) $(LIBS)
# Create a version of the gdc driver which calls the cross-compiler.
gdc-cross$(exeext): gdc$(exeext)
-rm -f gdc-cross$(exeext)
cp gdc$(exeext) gdc-cross$(exeext)
# Filter out pedantic and virtual overload warnings.
d-warn = $(filter-out -pedantic -Woverloaded-virtual, $(STRICT_WARN))
# Also filter out warnings for missing format attributes in the D Frontend.
DMD_WARN_CXXFLAGS = $(filter-out -Wmissing-format-attribute, $(WARN_CXXFLAGS))
DMD_COMPILE = $(subst $(WARN_CXXFLAGS), $(DMD_WARN_CXXFLAGS), $(COMPILE))
DMDGEN_COMPILE = $(subst $(COMPILER), $(COMPILER_FOR_BUILD), $(DMD_COMPILE))
# D Frontend object files.
D_FRONTEND_OBJS = \
d/aav.o \
d/access.o \
d/aliasthis.o \
d/apply.o \
d/argtypes.o \
d/arrayop.o \
d/attrib.o \
d/blockexit.o \
d/canthrow.o \
d/checkedint.o \
d/clone.o \
d/cond.o \
d/constfold.o \
d/cppmangle.o \
d/ctfeexpr.o \
d/dcast.o \
d/dclass.o \
d/declaration.o \
d/delegatize.o \
d/denum.o \
d/dimport.o \
d/dinterpret.o \
d/dmacro.o \
d/dmangle.o \
d/dmodule.o \
d/doc.o \
d/dscope.o \
d/dstruct.o \
d/dsymbol.o \
d/dtemplate.o \
d/dversion.o \
d/entity.o \
d/escape.o \
d/expression.o \
d/expressionsem.o \
d/file.o \
d/filename.o \
d/func.o \
d/hdrgen.o \
d/iasm.o \
d/iasmgcc.o \
d/identifier.o \
d/imphint.o \
d/init.o \
d/initsem.o \
d/intrange.o \
d/json.o \
d/lexer.o \
d/mtype.o \
d/nogc.o \
d/nspace.o \
d/objc.o \
d/opover.o \
d/optimize.o \
d/outbuffer.o \
d/parse.o \
d/rmem.o \
d/rootobject.o \
d/safe.o \
d/sapply.o \
d/sideeffect.o \
d/speller.o \
d/statement.o \
d/statementsem.o \
d/staticassert.o \
d/staticcond.o \
d/stringtable.o \
d/tokens.o \
d/traits.o \
d/typesem.o \
d/utf.o \
d/utils.o
# D Frontend generated files.
D_GENERATED_SRCS = d/id.c d/id.h d/impcnvtab.c
D_GENERATED_OBJS = d/id.o d/impcnvtab.o
# Language-specific object files for D.
D_OBJS = \
d/d-attribs.o d/d-builtins.o d/d-codegen.o d/d-convert.o \
d/d-diagnostic.o d/d-frontend.o d/d-incpath.o d/d-lang.o \
d/d-longdouble.o d/d-target.o d/decl.o d/expr.o d/imports.o \
d/intrinsics.o d/modules.o d/runtime.o d/toir.o d/typeinfo.o d/types.o
# All language-specific object files for D.
D_ALL_OBJS = $(D_FRONTEND_OBJS) $(D_GENERATED_OBJS) $(D_OBJS) $(D_TARGET_OBJS)
d_OBJS = $(D_ALL_OBJS) d/d-spec.o
d21$(exeext): $(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
# Documentation.
D_TEXI_FILES = \
d/gdc.texi \
$(gcc_docdir)/include/fdl.texi \
$(gcc_docdir)/include/gpl_v3.texi \
$(gcc_docdir)/include/gcc-common.texi \
gcc-vers.texi
doc/gdc.info: $(D_TEXI_FILES)
if test "x$(BUILD_INFO)" = xinfo; then \
rm -f doc/gdc.info*; \
$(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
-I $(gcc_docdir)/include -o $@ $<; \
else true; fi
doc/gdc.dvi: $(D_TEXI_FILES)
$(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
doc/gdc.pdf: $(D_TEXI_FILES)
$(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
$(build_htmldir)/d/index.html: $(D_TEXI_FILES)
$(mkinstalldirs) $(@D)
rm -f $(@D)/*
$(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
-I $(srcdir)/d -o $(@D) $<
.INTERMEDIATE: gdc.pod
gdc.pod: d/gdc.texi
-$(TEXI2POD) -D gdc < $< > $@
# Build hooks.
d.all.cross: gdc-cross$(exeext)
d.start.encap: gdc$(exeext)
d.rest.encap:
d.info: doc/gdc.info
d.dvi: doc/gdc.dvi
d.pdf: doc/gdc.pdf
d.html: $(build_htmldir)/d/index.html
d.srcinfo: doc/gdc.info
-cp -p $^ $(srcdir)/doc
d.srcextra:
d.tags: force
cd $(srcdir)/d; \
etags -o TAGS.sub *.c *.cc *.h dmd/*.c dmd/*.h dmd/root/*.h dmd/root/*.c; \
etags --include TAGS.sub --include ../TAGS.sub
d.man: doc/gdc.1
d.srcman: doc/gdc.1
-cp -p $^ $(srcdir)/doc
# 'make check' in gcc/ looks for check-d, as do all toplevel D-related
# check targets. However, our DejaGNU framework requires 'check-gdc' as its
# entry point. We feed the former to the latter here.
check-d: check-gdc
lang_checks += check-gdc
lang_checks_parallelized += check-gdc
check_gdc_parallelize = 10
# No D-specific selftests.
selftest-d:
# Install hooks.
d.install-common: installdirs
-rm -f $(DESTDIR)$(bindir)/$(D_INSTALL_NAME)$(exeext)
$(INSTALL_PROGRAM) gdc$(exeext) $(DESTDIR)$(bindir)/$(D_INSTALL_NAME)$(exeext)
-if test -f d21$(exeext); then \
if test -f gdc-cross$(exeext); then \
:; \
else \
rm -f $(DESTDIR)$(bindir)/$(D_TARGET_INSTALL_NAME)$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(D_INSTALL_NAME)$(exeext) $(D_TARGET_INSTALL_NAME)$(exeext) ); \
fi; \
fi
d.install-plugin:
d.install-info: $(DESTDIR)$(infodir)/gdc.info
d.install-pdf: doc/gdc.pdf
@$(NORMAL_INSTALL)
test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
@for p in doc/gdc.pdf; 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
d.install-html: $(build_htmldir)/d
@$(NORMAL_INSTALL)
test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
@for p in $(build_htmldir)/d; do \
if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
f=$(html__strip_dir) \
if test -d "$$d$$p"; then \
echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
$(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
$(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
else \
echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
$(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
fi; \
done
d.install-man: $(DESTDIR)$(man1dir)/$(D_INSTALL_NAME)$(man1ext)
$(DESTDIR)$(man1dir)/$(D_INSTALL_NAME)$(man1ext): doc/gdc.1 installdirs
-rm -f $@
-$(INSTALL_DATA) $< $@
-chmod a-x $@
d.uninstall:
-rm -rf $(DESTDIR)$(bindir)/$(D_INSTALL_NAME)$(exeext)
-rm -rf $(DESTDIR)$(man1dir)/$(D_INSTALL_NAME)$(man1ext)
-rm -rf $(DESTDIR)$(bindir)/$(D_TARGET_INSTALL_NAME)$(exeext)
-rm -rf $(DESTDIR)$(infodir)/gdc.info*
# Clean hooks.
d.mostlyclean:
-rm -f d/*$(objext)
-rm -f d/*$(coverageexts)
-rm -f $(D_GENERATED_SRCS)
-rm -f d/idgen$(build_exeext) d/impcnvgen$(build_exeext)
-rm -f gdc$(exeext) gdc-cross$(exeext) d21$(exeext)
d.clean:
d.distclean:
d.maintainer-clean:
-rm -f $(docobjdir)/gdc.1
# Stage hooks.
d.stage1: stage1-start
-mv d/*$(objext) stage1/d
d.stage2: stage2-start
-mv d/*$(objext) stage2/d
d.stage3: stage3-start
-mv d/*$(objext) stage3/d
d.stage4: stage4-start
-mv d/*$(objext) stage4/d
d.stageprofile: stageprofile-start
-mv d/*$(objext) stageprofile/d
d.stagefeedback: stagefeedback-start
-mv d/*$(objext) stagefeedback/d
# Include the dfrontend and build directories for headers.
D_INCLUDES = -I$(srcdir)/d -I$(srcdir)/d/dmd -Id
CFLAGS-d/id.o += $(D_INCLUDES)
CFLAGS-d/impcnvtab.o += $(D_INCLUDES)
# Override build rules for D frontend.
d/%.o: d/dmd/%.c $(D_GENERATED_SRCS)
$(DMD_COMPILE) $(D_INCLUDES) $<
$(POSTCOMPILE)
d/%.o: d/dmd/root/%.c $(D_GENERATED_SRCS)
$(DMD_COMPILE) $(D_INCLUDES) $<
$(POSTCOMPILE)
# Generated programs.
d/idgen$(build_exeext): d/idgen.dmdgen.o $(BUILD_LIBDEPS)
+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
$(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
d/impcnvgen$(build_exeext): d/impcnvgen.dmdgen.o $(BUILD_LIBDEPS)
+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
$(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
# Generated sources.
d/id.c: d/idgen$(build_exeext)
cd d && ./idgen$(build_exeext)
# idgen also generates id.h; just verify it exists.
d/id.h: d/id.c
d/impcnvtab.c: d/impcnvgen$(build_exeext)
cd d && ./impcnvgen$(build_exeext)
d/%.dmdgen.o: $(srcdir)/d/dmd/%.c
$(DMDGEN_COMPILE) $(D_INCLUDES) $<
$(POSTCOMPILE)
|