1# Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend. 2 3# Copyright (C) 2009-2020 Free Software Foundation, Inc. 4 5# This file is part of GCC. 6 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) 10# any later version. 11 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. 16 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/>. 20 21# This file provides the language dependent support in the main Makefile. 22 23# Installation name. 24 25GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)') 26GCCGO_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gccgo|sed '$(program_transform_name)') 27 28# The name for selecting go in LANGUAGES. 29go: go1$(exeext) 30 31.PHONY: go 32 33CFLAGS-go/gospec.o += $(DRIVER_DEFINES) 34 35GCCGO_OBJS = $(GCC_OBJS) go/gospec.o 36gccgo$(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) 40 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. 44gccgo-cross$(exeext): gccgo$(exeext) 45 -rm -f gccgo-cross$(exeext) 46 cp gccgo$(exeext) gccgo-cross$(exeext) 47 48# Use strict warnings. 49go-warn = $(STRICT_WARN) 50 51GO_OBJS = \ 52 go/ast-dump.o \ 53 go/escape.o \ 54 go/export.o \ 55 go/expressions.o \ 56 go/go-backend.o \ 57 go/go-diagnostics.o \ 58 go/go-encode-id.o \ 59 go/go-dump.o \ 60 go/go-gcc.o \ 61 go/go-gcc-diagnostics.o \ 62 go/go-lang.o \ 63 go/go-linemap.o \ 64 go/go-optimize.o \ 65 go/go-sha1.o \ 66 go/go.o \ 67 go/gogo.o \ 68 go/import.o \ 69 go/import-archive.o \ 70 go/lex.o \ 71 go/names.o \ 72 go/parse.o \ 73 go/runtime.o \ 74 go/statements.o \ 75 go/types.o \ 76 go/unsafe.o \ 77 go/wb.o 78 79go_OBJS = $(GO_OBJS) go/gospec.o 80 81go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) 82 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ 83 $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) 84 85# Documentation. 86 87GO_TEXI_FILES = \ 88 go/gccgo.texi \ 89 $(gcc_docdir)/include/fdl.texi \ 90 $(gcc_docdir)/include/gpl_v3.texi \ 91 $(gcc_docdir)/include/gcc-common.texi \ 92 gcc-vers.texi 93 94doc/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 $@ $<; \ 99 else true; fi 100 101doc/gccgo.dvi: $(GO_TEXI_FILES) 102 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< 103 104doc/gccgo.pdf: $(GO_TEXI_FILES) 105 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< 106 107$(build_htmldir)/go/index.html: $(GO_TEXI_FILES) 108 $(mkinstalldirs) $(@D) 109 rm -f $(@D)/* 110 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \ 111 -I $(srcdir)/go -o $(@D) $< 112 113.INTERMEDIATE: gccgo.pod 114 115gccgo.pod: go/gccgo.texi 116 -$(TEXI2POD) -D gccgo < $< > $@ 117 118# Build hooks. 119 120go.all.cross: gccgo-cross$(exeext) 121go.start.encap: gccgo$(exeext) 122go.rest.encap: 123go.info: doc/gccgo.info 124go.dvi: doc/gccgo.dvi 125go.pdf: doc/gccgo.pdf 126go.html: $(build_htmldir)/go/index.html 127go.srcinfo: doc/gccgo.info 128 -cp -p $^ $(srcdir)/doc 129go.srcextra: 130go.tags: force 131 cd $(srcdir)/go; \ 132 etags -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \ 133 etags --include TAGS.sub --include ../TAGS.sub 134go.man: doc/gccgo.1 135go.srcman: doc/gccgo.1 136 -cp -p $^ $(srcdir)/doc 137 138lang_checks += check-go 139lang_checks_parallelized += check-go 140check_go_parallelize = 10 141 142# No go-specific selftests 143selftest-go: 144 145# Install hooks. 146 147go.install-common: installdirs 148 -rm -f $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext) 149 $(INSTALL_PROGRAM) gccgo$(exeext) $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext) 150 -if test -f go1$(exeext); then \ 151 if test -f gccgo-cross$(exeext); then \ 152 :; \ 153 else \ 154 rm -f $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext); \ 155 ( cd $(DESTDIR)$(bindir) && \ 156 $(LN) $(GCCGO_INSTALL_NAME)$(exeext) $(GCCGO_TARGET_INSTALL_NAME)$(exeext) ); \ 157 fi; \ 158 fi 159 160go.install-plugin: 161 162go.install-info: $(DESTDIR)$(infodir)/gccgo.info 163 164go.install-pdf: doc/gccgo.pdf 165 @$(NORMAL_INSTALL) 166 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" 167 @for p in doc/gccgo.pdf; do \ 168 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 169 f=$(pdf__strip_dir) \ 170 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ 171 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ 172 done 173 174go.install-html: $(build_htmldir)/go 175 @$(NORMAL_INSTALL) 176 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" 177 @for p in $(build_htmldir)/go; do \ 178 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ 179 f=$(html__strip_dir) \ 180 if test -d "$$d$$p"; then \ 181 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ 182 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ 183 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ 184 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ 185 else \ 186 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ 187 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ 188 fi; \ 189 done 190 191go.install-man: $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext) 192 193$(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext): doc/gccgo.1 installdirs 194 -rm -f $@ 195 -$(INSTALL_DATA) $< $@ 196 -chmod a-x $@ 197 198go.uninstall: 199 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_INSTALL_NAME)$(exeext) 200 rm -rf $(DESTDIR)$(man1dir)/$(GCCGO_INSTALL_NAME)$(man1ext) 201 rm -rf $(DESTDIR)$(bindir)/$(GCCGO_TARGET_INSTALL_NAME)$(exeext) 202 rm -rf $(DESTDIR)$(infodir)/gccgo.info* 203 204# Clean hooks. 205 206go.mostlyclean: 207 -rm -f go/*$(objext) 208 -rm -f go/*$(coverageexts) 209 -rm -f gccgo$(exeext) gccgo-cross$(exeext) go1$(exeext) 210go.clean: 211go.distclean: 212go.maintainer-clean: 213 -rm -f $(docobjdir)/gccgo.1 214 215# Stage hooks. 216 217go.stage1: stage1-start 218 -mv go/*$(objext) stage1/go 219go.stage2: stage2-start 220 -mv go/*$(objext) stage2/go 221go.stage3: stage3-start 222 -mv go/*$(objext) stage3/go 223go.stage4: stage4-start 224 -mv go/*$(objext) stage4/go 225go.stageprofile: stageprofile-start 226 -mv go/*$(objext) stageprofile/go 227go.stagefeedback: stagefeedback-start 228 -mv go/*$(objext) stagefeedback/go 229 230CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \ 231 -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" 232 233GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend 234 235CFLAGS-go/go-gcc.o += $(GOINCLUDES) 236CFLAGS-go/go-linemap.o += $(GOINCLUDES) 237CFLAGS-go/go-sha1.o += $(GOINCLUDES) 238CFLAGS-go/go-gcc-diagnostics.o += $(GOINCLUDES) 239CFLAGS-go/go-encode-id.o += $(GOINCLUDES) 240 241go/%.o: go/gofrontend/%.cc 242 $(COMPILE) $(GOINCLUDES) $< 243 $(POSTCOMPILE) 244