提交 99464978 编写于 作者: M Mislav Marohnić

[make] Use GOFLAGS instead of manually passing `-mod=vendor`

上级 0846e42e
......@@ -3,12 +3,12 @@ SOURCE_DATE_EPOCH ?= $(shell date +%s)
BUILD_DATE = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" '+%d %b %Y' 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" '+%d %b %Y')
HUB_VERSION = $(shell bin/hub version | tail -1)
FLAGS_ALL = $(shell go version | grep -q 'go1.[89]' || echo 'all=')
export MOD_VENDOR_ARG := $(shell go version | grep -q 'go1.1[^01]' && echo '-mod=vendor')
export GOFLAGS := $(shell go version | grep -q 'go1.1[^0]' && echo '-mod=vendor')
export LDFLAGS := -extldflags '$(LDFLAGS)'
export GCFLAGS := $(FLAGS_ALL)-trimpath '$(PWD)'
export ASMFLAGS := $(FLAGS_ALL)-trimpath '$(PWD)'
ifneq ($(MOD_VENDOR_ARG),)
ifneq ($(GOFLAGS),)
export GO111MODULE=on
unexport GOPATH
endif
......@@ -52,7 +52,7 @@ bin/hub: $(SOURCES)
script/build -o $@
bin/md2roff: $(SOURCES)
go build $(MOD_VENDOR_ARG) -o $@ github.com/github/hub/md2roff-bin
go build -o $@ github.com/github/hub/md2roff-bin
test:
go test ./...
......
......@@ -14,7 +14,6 @@ find_source_files() {
build_hub() {
mkdir -p "$(dirname "$1")"
go build \
$MOD_VENDOR_ARG \
-ldflags "-X github.com/github/hub/version.Version=`./script/version` $LDFLAGS" \
-gcflags "$GCFLAGS" \
-asmflags "$ASMFLAGS" \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册