summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMichael Henderson <mdhender@mdhender.com>2017-07-15 15:18:38 -0600
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-07-16 00:35:15 +0200
commitea5e9e346c93320538c6517b619b5f57473291c8 (patch)
treeb3645b40b7341ff1f7ab8cc7cfb18a9a54bfa225 /Makefile
parent61bb3ccab3a552c4b80ffb5370714598660b7b37 (diff)
Add GOEXE to support building with different versions of `go`
Add a variable to the makefile and benchmark scripts to let users change the command used to build. Doesn't impact tools like govendor.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 4508ab7cf..0518967ce 100644
--- a/Makefile
+++ b/Makefile
@@ -6,21 +6,24 @@ BUILD_DATE = `date +%FT%T%z`
LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.CommitHash=${COMMIT_HASH} -X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}"
NOGI_LDFLAGS = -ldflags "-X ${PACKAGE}/hugolib.BuildDate=${BUILD_DATE}"
+# allow user to override go executable by running as GOEXE=xxx make ... on unix-like systems
+GOEXE ?= go
+
.PHONY: vendor docker check fmt lint test test-race vet test-cover-html help
.DEFAULT_GOAL := help
vendor: ## Install govendor and sync Hugo's vendored dependencies
- go get github.com/kardianos/govendor
+ ${GOEXE} get github.com/kardianos/govendor
govendor sync ${PACKAGE}
hugo: vendor ## Build hugo binary
- go build ${LDFLAGS} ${PACKAGE}
+ ${GOEXE} build ${LDFLAGS} ${PACKAGE}
hugo-race: vendor ## Build hugo binary with race detector enabled
- go build -race ${LDFLAGS} ${PACKAGE}
+ ${GOEXE} build -race ${LDFLAGS} ${PACKAGE}
install: vendor ## Install hugo binary
- go install ${LDFLAGS} ${PACKAGE}
+ ${GOEXE} install ${LDFLAGS} ${PACKAGE}
hugo-no-gitinfo: LDFLAGS = ${NOGI_LDFLAGS}
hugo-no-gitinfo: vendor hugo ## Build hugo without git info
@@ -74,7 +77,7 @@ test-cover-html: ## Generate test coverage report
$(foreach pkg,$(PACKAGES),\
govendor test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
- go tool cover -html=coverage-all.out
+ ${GOEXE} tool cover -html=coverage-all.out
check-vendor: ## Verify that vendored packages match git HEAD
@git diff-index --quiet HEAD vendor/ || (echo "check-vendor target failed: vendored packages out of sync" && echo && git diff vendor/ && exit 1)