1 # Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend.
3 # Copyright (C) 2009-2024 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.
30 go.serial = go1$(exeext)
34 CFLAGS-go/gospec.o += $(DRIVER_DEFINES)
36 GCCGO_OBJS = $(GCC_OBJS) go/gospec.o
37 gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
38 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
39 $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
40 $(EXTRA_GCC_LIBS) $(LIBS)
42 # The cross-compiler version. This is built mainly as a signal to the
43 # go.install-common target. If this executable exists, it means that
44 # go.all.cross was run.
45 gccgo-cross$(exeext): gccgo$(exeext)
46 -rm -f gccgo-cross$(exeext)
47 cp gccgo$(exeext) gccgo-cross$(exeext)
49 # Use strict warnings.
50 go-warn = $(STRICT_WARN)
63 go/go-gcc-diagnostics.o \
81 go_OBJS = $(GO_OBJS) go/gospec.o
83 go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(go.prev)
84 @$(call LINK_PROGRESS,$(INDEX.go),start)
85 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
86 $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
87 @$(call LINK_PROGRESS,$(INDEX.go),end)
93 $(gcc_docdir)/include/fdl.texi \
94 $(gcc_docdir)/include/gpl_v3.texi \
95 $(gcc_docdir)/include/gcc-common.texi \
98 doc/gccgo.info: $(GO_TEXI_FILES)
99 if test "x$(BUILD_INFO)" = xinfo; then \
100 rm -f doc/gccgo.info*; \
101 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
102 -I $(gcc_docdir)/include -o $@ $<; \
105 doc/gccgo.dvi: $(GO_TEXI_FILES)
106 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
108 doc/gccgo.pdf: $(GO_TEXI_FILES)
109 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
111 $(build_htmldir)/go/index.html: $(GO_TEXI_FILES)
112 $(mkinstalldirs) $(@D)
114 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
115 -I $(srcdir)/go -o $(@D) $<
117 .INTERMEDIATE: gccgo.pod
119 gccgo.pod: go/gccgo.texi
120 -$(TEXI2POD) -D gccgo < $< > $@
124 go.all.cross: gccgo-cross$(exeext)
125 go.start.encap: gccgo$(exeext)
127 go.info: doc/gccgo.info
128 go.dvi: doc/gccgo.dvi
129 go.pdf: doc/gccgo.pdf
130 go.html: $(build_htmldir)/go/index.html
131 go.srcinfo: doc/gccgo.info
132 -cp -p $^ $(srcdir)/doc
136 $(ETAGS) -o TAGS.sub *.cc *.h gofrontend/*.h gofrontend/*.cc; \
137 $(ETAGS) --include TAGS.sub --include ../TAGS.sub
139 go.srcman: doc/gccgo.1
140 -cp -p $^ $(srcdir)/doc
142 lang_checks += check-go
143 lang_checks_parallelized += check-go
144 check_go_parallelize = 10
146 # No go-specific selftests
151 go.install-common: installdirs
152 -rm -f $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
153 $(INSTALL_PROGRAM) gccgo$(exeext) $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
154 -if test -f go1$(exeext); then \
155 if test -f gccgo-cross$(exeext); then \
158 rm -f $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext); \
159 ( cd $(DESTDIR)$(bindir) && \
160 $(LN) $(GCCGO_INSTALL_NAME)$(exeext) $(GCCGO_TARGET_INSTALL_NAME)$(exeext) ); \
166 go.install-info: $(DESTDIR)$(infodir)/gccgo.info
168 go.install-pdf: doc/gccgo.pdf
170 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
171 @for p in doc/gccgo.pdf; do \
172 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
173 f=$(pdf__strip_dir) \
174 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
175 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
178 go.install-html: $(build_htmldir)/go
180 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
181 @for p in $(build_htmldir)/go; do \
182 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
183 f=$(html__strip_dir) \
184 if test -d "$$d$$p"; then \
185 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
186 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
187 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
188 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
190 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
191 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
195 go.install-man: $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext)
197 $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext): doc/gccgo.1 installdirs
199 -$(INSTALL_DATA) $< $@
203 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext)
204 rm -rf $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext)
205 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext)
206 rm -rf $(DESTDIR)$(infodir)/gccgo.info*
212 -rm -f go/*$(coverageexts)
213 -rm -f gccgo$(exeext) gccgo-cross$(exeext) go1$(exeext)
217 -rm -f $(docobjdir)/gccgo.1
221 go.stage1: stage1-start
222 -mv go/*$(objext) stage1/go
223 go.stage2: stage2-start
224 -mv go/*$(objext) stage2/go
225 go.stage3: stage3-start
226 -mv go/*$(objext) stage3/go
227 go.stage4: stage4-start
228 -mv go/*$(objext) stage4/go
229 go.stageprofile: stageprofile-start
230 -mv go/*$(objext) stageprofile/go
231 go.stagefeedback: stagefeedback-start
232 -mv go/*$(objext) stagefeedback/go
234 CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \
235 -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\"
237 GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend
239 CFLAGS-go/go-gcc.o += $(GOINCLUDES)
240 CFLAGS-go/go-linemap.o += $(GOINCLUDES)
241 CFLAGS-go/go-sha1.o += $(GOINCLUDES)
242 CFLAGS-go/go-gcc-diagnostics.o += $(GOINCLUDES)
243 CFLAGS-go/go-encode-id.o += $(GOINCLUDES)
245 go/%.o: go/gofrontend/%.cc
246 $(COMPILE) $(GOINCLUDES) $<