1 # Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend.
3 # Copyright (C) 2009-2013 Free Software Foundation, Inc.
5 # This file is part of GCC.
7 # GCC is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GCC is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GCC; see the file COPYING3. If not see
19 # <http://www.gnu.org/licenses/>.
21 # This file provides the language dependent support in the main Makefile.
25 GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
26 GCCGO_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gccgo|sed '$(program_transform_name)')
28 # The name for selecting go in LANGUAGES.
33 gospec.o: $(srcdir)/go/gospec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
36 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
37 $(INCLUDES) $(srcdir)/go/gospec.c)
39 GCCGO_OBJS = $(GCC_OBJS) gospec.o
40 gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
41 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
42 $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
43 $(EXTRA_GCC_LIBS) $(LIBS)
45 # The cross-compiler version. This is built mainly as a signal to the
46 # go.install-common target. If this executable exists, it means that
47 # go.all.cross was run.
48 gccgo-cross$(exeext): gccgo$(exeext)
49 -rm -f gccgo-cross$(exeext)
50 cp gccgo$(exeext) gccgo-cross$(exeext)
52 # Use strict warnings.
53 go-warn = $(STRICT_WARN)
78 go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
79 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
80 $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
86 $(gcc_docdir)/include/fdl.texi \
87 $(gcc_docdir)/include/gpl_v3.texi \
88 $(gcc_docdir)/include/gcc-common.texi \
91 doc/gccgo.info: $(GO_TEXI_FILES)
92 if test "x$(BUILD_INFO)" = xinfo; then \
93 rm -f doc/gccgo.info*; \
94 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
95 -I $(gcc_docdir)/include -o $@ $<; \
98 doc/gccgo.dvi: $(GO_TEXI_FILES)
99 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
101 doc/gccgo.pdf: $(GO_TEXI_FILES)
102 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
104 $(build_htmldir)/go/index.html: $(GO_TEXI_FILES)
105 $(mkinstalldirs) $(@D)
107 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
108 -I $(srcdir)/go -o $(@D) $<
110 .INTERMEDIATE: gccgo.pod
112 gccgo.pod: go/gccgo.texi
113 -$(TEXI2POD) -D gccgo < $< > $@
117 go.all.cross: gccgo-cross$(exeext)
118 go.start.encap: gccgo$(exeext)
120 go.info: doc/gccgo.info
121 go.dvi: doc/gccgo.dvi
122 go.pdf: doc/gccgo.pdf
123 go.html: $(build_htmldir)/go/index.html
124 go.srcinfo: doc/gccgo.info
125 -cp -p $^ $(srcdir)/doc
129 etags -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \
130 etags --include TAGS.sub --include ../TAGS.sub
132 go.srcman: doc/gccgo.1
133 -cp -p $^ $(srcdir)/doc
135 lang_checks += check-go
136 lang_checks_parallelized += check-go
137 check_go_parallelize = go-test.exp=*/test/\[0-57-9a-bd-hj-zA-Z\]* \
138 go-test.exp=*/test/c* \
139 go-test.exp=*/test/i* \
140 go-test.exp=*/test/6*
144 go.install-common: installdirs
145 -rm -f $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
146 $(INSTALL_PROGRAM) gccgo$(exeext) $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
147 -if test -f go1$(exeext); then \
148 if test -f gccgo-cross$(exeext); then \
151 rm -f $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext); \
152 ( cd $(DESTDIR)$(bindir) && \
153 $(LN) $(GCCGO_INSTALL_NAME)$(exeext) $(GCCGO_TARGET_INSTALL_NAME)$(exeext) ); \
159 go.install-info: $(DESTDIR)$(infodir)/gccgo.info
161 go.install-pdf: doc/gccgo.pdf
163 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
164 @for p in doc/gccgo.pdf; do \
165 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
166 f=$(pdf__strip_dir) \
167 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
168 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
171 go.install-html: $(build_htmldir)/go
173 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
174 @for p in $(build_htmldir)/go; do \
175 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
176 f=$(html__strip_dir) \
177 if test -d "$$d$$p"; then \
178 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
179 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
180 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
181 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
183 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
184 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
188 go.install-man: $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext)
190 $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext): doc/gccgo.1 installdirs
192 -$(INSTALL_DATA) $< $@
196 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
197 rm -rf $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext)
198 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext)
199 rm -rf $(DESTDIR)$(infodir)/gccgo.info*
205 -rm -f go/*$(coverageexts)
209 -rm -f $(docobjdir)/gccgo.1
213 go.stage1: stage1-start
214 -mv go/*$(objext) stage1/go
215 go.stage2: stage2-start
216 -mv go/*$(objext) stage2/go
217 go.stage3: stage3-start
218 -mv go/*$(objext) stage3/go
219 go.stage4: stage4-start
220 -mv go/*$(objext) stage4/go
221 go.stageprofile: stageprofile-start
222 -mv go/*$(objext) stageprofile/go
223 go.stagefeedback: stagefeedback-start
224 -mv go/*$(objext) stagefeedback/go
226 GO_SYSTEM_H = go/go-system.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
227 $(DIAGNOSTIC_CORE_H) $(INPUT_H) intl.h
229 GO_C_H = go/go-c.h $(MACHMODE_H)
230 GO_LINEMAP_H = go/gofrontend/go-linemap.h $(GO_SYSTEM_H) go/go-location.h
231 GO_LEX_H = go/gofrontend/lex.h go/gofrontend/operator.h $(GO_LINEMAP_H)
232 GO_PARSE_H = go/gofrontend/parse.h
233 GO_GOGO_H = go/gofrontend/gogo.h $(GO_LINEMAP_H)
234 GO_TYPES_H = go/gofrontend/types.h $(GO_LINEMAP_H)
235 GO_STATEMENTS_H = go/gofrontend/statements.h go/gofrontend/operator.h
236 GO_EXPRESSIONS_H = go/gofrontend/expressions.h go/gofrontend/operator.h
237 GO_EXPORT_H = go/gofrontend/export.h go/gofrontend/string-dump.h
238 GO_IMPORT_H = go/gofrontend/import.h $(GO_EXPORT_H) $(GO_LINEMAP_H)
239 GO_RUNTIME_H = go/gofrontend/runtime.h go/gofrontend/runtime.def
240 GO_AST_DUMP_H = go/gofrontend/ast-dump.h go/gofrontend/string-dump.h
242 go/go-backend.o: go/go-backend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
243 $(TM_H) $(TREE_H) $(TM_P_H) output.h $(TARGET_H) \
246 CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \
247 -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\"
248 go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
249 $(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
250 $(FLAGS_H) convert.h $(DIAGNOSTIC_H) langhooks.h \
251 $(LANGHOOKS_DEF_H) $(TARGET_H) $(GO_C_H) \
252 gt-go-go-lang.h gtype-go.h $(COMMON_TARGET_H)
254 GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend
256 go/go-gcc.o: go/go-gcc.cc $(GO_SYSTEM_H) $(TREE_H) tree-iterator.h \
257 $(GIMPLE_H) toplev.h output.h $(GO_C_H) $(GO_GOGO_H) \
258 go/gofrontend/backend.h
259 $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
261 go/go-linemap.o: go/go-linemap.cc $(GO_SYSTEM_H) $(GO_LINEMAP_H)
262 $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
264 go/%.o: go/gofrontend/%.cc
265 $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
267 go/ast-dump.o: go/gofrontend/ast-dump.cc $(GO_SYSTME_H) $(GO_GOGO_H) \
268 $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_TYPES_H) \
269 $(GO_AST_DUMP_H) $(GO_C_H) go/gofrontend/go-dump.h
270 go/dataflow.o: go/gofrontend/dataflow.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
271 $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) go/gofrontend/dataflow.h
272 go/export.o: go/gofrontend/export.cc $(GO_SYSTEM_H) \
273 $(srcdir)/../include/sha1.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
274 $(GO_STATEMENTS_H) $(GO_EXPORT_H)
275 go/expressions.o: go/gofrontend/expressions.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
276 intl.h $(TREE_H) $(GIMPLE_H) tree-iterator.h convert.h $(REAL_H) \
277 realmpfr.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
278 $(GO_EXPORT_H) $(GO_IMPORT_H) $(GO_STATEMENTS_H) $(GO_LEX_H) \
279 $(GO_RUNTIME_H) go/gofrontend/backend.h $(GO_EXPRESSIONS_H) \
281 go/go.o: go/gofrontend/go.cc $(GO_SYSTEM_H) $(GO_C_H) $(GO_LEX_H) \
282 $(GO_PARSE_H) go/gofrontend/backend.h $(GO_GOGO_H)
283 go/go-dump.o: go/gofrontend/go-dump.cc $(GO_SYSTEM_H) $(GO_C_H) \
284 go/gofrontend/go-dump.h
285 go/go-optimize.o: go/gofrontend/go-optimize.cc $(GO_SYSTEM_H) $(GO_C_H) \
286 go/gofrontend/go-optimize.h
287 go/gogo-tree.o: go/gofrontend/gogo-tree.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
288 $(TREE_H) $(GIMPLE_H) tree-iterator.h $(CGRAPH_H) langhooks.h \
289 convert.h output.h $(DIAGNOSTIC_H) $(GO_TYPES_H) \
290 $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_RUNTIME_H) \
291 go/gofrontend/backend.h $(GO_GOGO_H)
292 go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) \
293 $(srcdir)/../include/filenames.h $(GO_C_H) go/gofrontend/go-dump.h \
294 $(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) $(GO_EXPRESSIONS_H) \
295 go/gofrontend/dataflow.h $(GO_RUNTIME_H) $(GO_IMPORT_H) \
296 $(GO_EXPORT_H) go/gofrontend/backend.h $(GO_GOGO_H)
297 go/import.o: go/gofrontend/import.cc $(GO_SYSTEM_H) \
298 $(srcdir)/../include/filenames.h $(srcdir)/../include/simple-object.h \
299 $(GO_C_H) $(GO_GOGO_H) $(GO_LEX_H) $(GO_TYPES_H) $(GO_EXPORT_H) \
301 go/import-archive.o: go/gofrontend/import-archive.cc $(GO_SYSTEM_H) \
303 go/lex.o: go/gofrontend/lex.cc $(GO_LEX_H) $(GO_SYSTEM_H)
304 go/parse.o: go/gofrontend/parse.cc $(GO_SYSTEM_H) $(GO_LEX_H) $(GO_GOGO_H) \
305 $(GO_TYPES_H) $(GO_STATEMENTS_H) $(GO_EXPRESSIONS_H) $(GO_PARSE_H)
306 go/runtime.o: go/gofrontend/runtime.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
307 $(GO_TYPES_H) $(GO_EXPRESSIONS_H) $(GO_RUNTIME_H) \
308 go/gofrontend/runtime.def
309 go/statements.o: go/gofrontend/statements.cc $(GO_SYSTEM_H) \
310 $(GO_C_H) $(GO_TYPES_H) $(GO_EXPRESSIONS_H) $(GO_GOGO_H) \
311 $(GO_RUNTIME_H) go/gofrontend/backend.h $(GO_STATEMENTS_H) \
313 go/types.o: go/gofrontend/types.cc $(GO_SYSTEM_H) $(TOPLEV_H) intl.h $(TREE_H) \
314 $(GIMPLE_H) $(REAL_H) convert.h $(GO_C_H) $(GO_GOGO_H) \
315 go/gofrontend/operator.h $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) \
316 $(GO_EXPORT_H) $(GO_IMPORT_H) go/gofrontend/backend.h $(GO_TYPES_H)
317 go/unsafe.o: go/gofrontend/unsafe.cc $(GO_SYSTEM_H) $(GO_C_H) $(GO_TYPES_H) \