1 # Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend.
3 # Copyright (C) 2009-2017 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 CFLAGS-go/gospec.o += $(DRIVER_DEFINES)
35 GCCGO_OBJS = $(GCC_OBJS) go/gospec.o
36 gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
37 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
38 $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
39 $(EXTRA_GCC_LIBS) $(LIBS)
41 # The cross-compiler version. This is built mainly as a signal to the
42 # go.install-common target. If this executable exists, it means that
43 # go.all.cross was run.
44 gccgo-cross$(exeext): gccgo$(exeext)
45 -rm -f gccgo-cross$(exeext)
46 cp gccgo$(exeext) gccgo-cross$(exeext)
48 # Use strict warnings.
49 go-warn = $(STRICT_WARN)
61 go/go-gcc-diagnostics.o \
79 go_OBJS = $(GO_OBJS) go/gospec.o
81 go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
82 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
83 $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
89 $(gcc_docdir)/include/fdl.texi \
90 $(gcc_docdir)/include/gpl_v3.texi \
91 $(gcc_docdir)/include/gcc-common.texi \
94 doc/gccgo.info: $(GO_TEXI_FILES)
95 if test "x$(BUILD_INFO)" = xinfo; then \
96 rm -f doc/gccgo.info*; \
97 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
98 -I $(gcc_docdir)/include -o $@ $<; \
101 doc/gccgo.dvi: $(GO_TEXI_FILES)
102 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
104 doc/gccgo.pdf: $(GO_TEXI_FILES)
105 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
107 $(build_htmldir)/go/index.html: $(GO_TEXI_FILES)
108 $(mkinstalldirs) $(@D)
110 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
111 -I $(srcdir)/go -o $(@D) $<
113 .INTERMEDIATE: gccgo.pod
115 gccgo.pod: go/gccgo.texi
116 -$(TEXI2POD) -D gccgo < $< > $@
120 go.all.cross: gccgo-cross$(exeext)
121 go.start.encap: gccgo$(exeext)
123 go.info: doc/gccgo.info
124 go.dvi: doc/gccgo.dvi
125 go.pdf: doc/gccgo.pdf
126 go.html: $(build_htmldir)/go/index.html
127 go.srcinfo: doc/gccgo.info
128 -cp -p $^ $(srcdir)/doc
132 etags -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \
133 etags --include TAGS.sub --include ../TAGS.sub
135 go.srcman: doc/gccgo.1
136 -cp -p $^ $(srcdir)/doc
138 lang_checks += check-go
139 lang_checks_parallelized += check-go
140 check_go_parallelize = 10
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)
206 -rm -f gccgo$(exeext) gccgo-cross$(exeext) go1$(exeext)
210 -rm -f $(docobjdir)/gccgo.1
214 go.stage1: stage1-start
215 -mv go/*$(objext) stage1/go
216 go.stage2: stage2-start
217 -mv go/*$(objext) stage2/go
218 go.stage3: stage3-start
219 -mv go/*$(objext) stage3/go
220 go.stage4: stage4-start
221 -mv go/*$(objext) stage4/go
222 go.stageprofile: stageprofile-start
223 -mv go/*$(objext) stageprofile/go
224 go.stagefeedback: stagefeedback-start
225 -mv go/*$(objext) stagefeedback/go
227 CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \
228 -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\"
230 GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend
232 CFLAGS-go/go-gcc.o += $(GOINCLUDES)
233 CFLAGS-go/go-linemap.o += $(GOINCLUDES)
234 CFLAGS-go/go-sha1.o += $(GOINCLUDES)
235 CFLAGS-go/go-gcc-diagnostics.o += $(GOINCLUDES)
236 CFLAGS-go/go-encode-id.o += $(GOINCLUDES)
238 go/%.o: go/gofrontend/%.cc
239 $(COMPILE) $(GOINCLUDES) $<