github.com/newrelic/newrelic-client-go@v1.1.0/build/util.mk (about) 1 # 2 # Makefile fragment for utility items 3 # 4 5 NATIVEOS ?= $(shell go version | awk -F '[ /]' '{print $$4}') 6 NATIVEARCH ?= $(shell go version | awk -F '[ /]' '{print $$5}') 7 8 GIT_HOOKS_PATH ?= .githooks 9 10 git-hooks: 11 @echo "=== $(PROJECT_NAME) === [ git-hooks ]: Configuring git hooks..." 12 @git config core.hooksPath $(GIT_HOOKS_PATH) 13 14 check-version: 15 ifdef GOOS 16 ifneq "$(GOOS)" "$(NATIVEOS)" 17 $(error GOOS is not $(NATIVEOS). Cross-compiling is only allowed for 'clean', 'deps-only' and 'compile-only' targets) 18 endif 19 else 20 GOOS = ${NATIVEOS} 21 endif 22 ifdef GOARCH 23 ifneq "$(GOARCH)" "$(NATIVEARCH)" 24 $(error GOARCH variable is not $(NATIVEARCH). Cross-compiling is only allowed for 'clean', 'deps-only' and 'compile-only' targets) 25 endif 26 else 27 GOARCH = ${NATIVEARCH} 28 endif 29 30 .PHONY: check-version