2015-01-09 22:23:09 +01:00
|
|
|
# Makefile for gotools
|
2016-06-07 10:54:22 +02:00
|
|
|
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
|
2015-01-09 22:23:09 +01:00
|
|
|
#
|
|
|
|
# This file 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 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 this program; see the file COPYING3. If not see
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
ACLOCAL_AMFLAGS = -I ./config -I ../config
|
|
|
|
|
|
|
|
gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion)
|
|
|
|
|
|
|
|
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
|
|
|
|
|
|
|
|
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
|
|
|
PWD_COMMAND = $${PWDCMD-pwd}
|
|
|
|
STAMP = echo timestamp >
|
|
|
|
|
|
|
|
libgodir = ../$(target_noncanonical)/libgo
|
|
|
|
LIBGODEP = $(libgodir)/libgo.la
|
|
|
|
|
2015-01-10 01:23:48 +01:00
|
|
|
if NATIVE
|
|
|
|
# Use the compiler we just built.
|
2015-12-02 20:27:58 +01:00
|
|
|
GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
|
2015-01-10 01:23:48 +01:00
|
|
|
else
|
|
|
|
GOCOMPILER = $(GOC)
|
|
|
|
endif
|
|
|
|
|
2015-01-09 22:23:09 +01:00
|
|
|
GOCFLAGS = $(CFLAGS_FOR_TARGET)
|
2015-01-10 01:23:48 +01:00
|
|
|
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
|
2015-01-09 22:23:09 +01:00
|
|
|
|
2015-01-24 00:11:59 +01:00
|
|
|
AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
|
2015-03-12 17:44:36 +01:00
|
|
|
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
|
2015-01-09 22:23:09 +01:00
|
|
|
|
|
|
|
cmdsrcdir = $(srcdir)/../libgo/go/cmd
|
|
|
|
|
|
|
|
go_cmd_go_files = \
|
2015-10-31 22:29:38 +01:00
|
|
|
$(cmdsrcdir)/go/alldocs.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/build.go \
|
|
|
|
$(cmdsrcdir)/go/clean.go \
|
|
|
|
$(cmdsrcdir)/go/context.go \
|
|
|
|
$(cmdsrcdir)/go/discovery.go \
|
2015-10-31 22:29:38 +01:00
|
|
|
$(cmdsrcdir)/go/doc.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/env.go \
|
|
|
|
$(cmdsrcdir)/go/fix.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/fmt.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/generate.go \
|
|
|
|
$(cmdsrcdir)/go/get.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/go11.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/help.go \
|
|
|
|
$(cmdsrcdir)/go/http.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/list.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/main.go \
|
2015-10-31 22:29:38 +01:00
|
|
|
$(cmdsrcdir)/go/note.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/pkg.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/run.go \
|
|
|
|
$(cmdsrcdir)/go/signal.go \
|
|
|
|
$(cmdsrcdir)/go/signal_unix.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/go/test.go \
|
2015-01-15 01:27:56 +01:00
|
|
|
$(cmdsrcdir)/go/testflag.go \
|
|
|
|
$(cmdsrcdir)/go/tool.go \
|
|
|
|
$(cmdsrcdir)/go/vcs.go \
|
|
|
|
$(cmdsrcdir)/go/version.go \
|
2015-03-24 20:50:31 +01:00
|
|
|
$(cmdsrcdir)/go/vet.go \
|
|
|
|
$(libgodir)/zstdpkglist.go
|
2015-01-09 22:23:09 +01:00
|
|
|
|
|
|
|
go_cmd_gofmt_files = \
|
|
|
|
$(cmdsrcdir)/gofmt/doc.go \
|
|
|
|
$(cmdsrcdir)/gofmt/gofmt.go \
|
2016-02-03 22:58:02 +01:00
|
|
|
$(cmdsrcdir)/gofmt/internal.go \
|
2015-01-09 22:23:09 +01:00
|
|
|
$(cmdsrcdir)/gofmt/rewrite.go \
|
|
|
|
$(cmdsrcdir)/gofmt/simplify.go
|
|
|
|
|
|
|
|
go_cmd_cgo_files = \
|
|
|
|
$(cmdsrcdir)/cgo/ast.go \
|
|
|
|
$(cmdsrcdir)/cgo/doc.go \
|
|
|
|
$(cmdsrcdir)/cgo/gcc.go \
|
|
|
|
$(cmdsrcdir)/cgo/godefs.go \
|
|
|
|
$(cmdsrcdir)/cgo/main.go \
|
|
|
|
$(cmdsrcdir)/cgo/out.go \
|
|
|
|
$(cmdsrcdir)/cgo/util.go
|
|
|
|
|
|
|
|
GCCGO_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
|
|
|
|
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
|
|
|
|
GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
|
|
|
|
|
|
|
|
zdefaultcc.go: s-zdefaultcc; @true
|
|
|
|
s-zdefaultcc: Makefile
|
|
|
|
echo 'package main' > zdefaultcc.go.tmp
|
|
|
|
echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >> zdefaultcc.go.tmp
|
|
|
|
echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
|
|
|
|
echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
|
|
|
|
$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
|
|
|
|
$(STAMP) $@
|
|
|
|
|
2015-01-10 01:23:48 +01:00
|
|
|
MOSTLYCLEANFILES = zdefaultcc.go s-zdefaultcc
|
|
|
|
|
2015-01-09 22:23:09 +01:00
|
|
|
if NATIVE
|
|
|
|
|
|
|
|
# For a native build we build the programs using the newly built libgo
|
|
|
|
# and install them as regular programs.
|
|
|
|
|
|
|
|
bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT)
|
2015-01-22 05:19:11 +01:00
|
|
|
noinst_PROGRAMS = cgo$(EXEEXT)
|
2015-01-23 02:42:08 +01:00
|
|
|
man_MANS = go.1 gofmt.1
|
2015-01-09 22:23:09 +01:00
|
|
|
|
|
|
|
go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
|
2015-01-20 10:26:50 +01:00
|
|
|
$(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
|
2015-01-09 22:23:09 +01:00
|
|
|
gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
|
2015-01-20 10:26:50 +01:00
|
|
|
$(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
|
2015-01-09 22:23:09 +01:00
|
|
|
cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
|
2015-01-20 10:26:50 +01:00
|
|
|
$(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
|
2015-01-09 22:23:09 +01:00
|
|
|
|
2015-01-22 05:19:11 +01:00
|
|
|
install-exec-local: cgo$(EXEEXT)
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libexecsubdir)
|
|
|
|
rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
|
|
|
|
$(INSTALL_PROGRAM) cgo$(exeext) $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
|
|
|
|
|
|
|
|
uninstall-local:
|
|
|
|
rm -f $(DESTDIR)$(libexecsubdir)/cgo$(exeext)
|
|
|
|
|
2015-01-09 22:23:09 +01:00
|
|
|
else
|
|
|
|
|
|
|
|
# For a non-native build we have to build the programs using a
|
|
|
|
# previously built host (or build -> host) Go compiler. We should
|
|
|
|
# only do this if such a compiler is available. We also need to get
|
|
|
|
# the right values for GOARCH and GOOS in the default build context in
|
|
|
|
# the go/build package. Figure this out later.
|
|
|
|
|
|
|
|
endif
|