diff --git a/Makefile b/Makefile index 7ee32b93e9..821b20ac3b 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,9 @@ PKG := github.com/heptio/ark REGISTRY ?= gcr.io/heptio-images # Which architecture to build - see $(ALL_ARCH) for options. +# if the 'local' rule is being run, detect the ARCH from 'go env' +# if it wasn't specified by the caller. +local : ARCH ?= $(shell go env GOOS)-$(shell go env GOARCH) ARCH ?= linux-amd64 VERSION ?= master @@ -79,6 +82,15 @@ all-build: $(addprefix build-, $(CLI_PLATFORMS)) #all-push: $(addprefix push-, $(CONTAINER_PLATFORMS)) +local: build-dirs + GOOS=$(GOOS) \ + GOARCH=$(GOARCH) \ + VERSION=$(VERSION) \ + PKG=$(PKG) \ + BIN=$(BIN) \ + OUTPUT_DIR=$$(pwd)/_output/bin/$(GOOS)/$(GOARCH) \ + ./hack/build.sh + build: _output/bin/$(GOOS)/$(GOARCH)/$(BIN) _output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs @@ -153,6 +165,11 @@ ifneq ($(SKIP_TESTS), 1) @$(MAKE) shell CMD="-c 'hack/test.sh $(SRC_DIRS)'" endif +test-local: build-dirs +ifneq ($(SKIP_TESTS), 1) + hack/test.sh $(SRC_DIRS) +endif + verify: ifneq ($(SKIP_TESTS), 1) @$(MAKE) shell CMD="-c 'hack/verify-all.sh'" diff --git a/docs/build-from-scratch.md b/docs/build-from-scratch.md index 95c3477a5d..17e9337a1c 100644 --- a/docs/build-from-scratch.md +++ b/docs/build-from-scratch.md @@ -63,8 +63,8 @@ Run [generate-proto.sh][13] to regenerate files if you make the following change ### Cross compiling -By default, `make` builds an `ark` binary that runs on your host operating system and architecture. -To build for another platform, run `make build---`. For example, to build for the Mac, run `make build-darwin-amd64`. All binaries are placed in `_output/bin//`-- for example, `_output/bin/darwin/amd64/ark`.