Merge pull request #711 from skriss/make-local

Bring back 'make local'
This commit is contained in:
Carlisia
2018-08-09 12:26:53 -07:00
committed by GitHub
2 changed files with 19 additions and 2 deletions

View File

@@ -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'"

View File

@@ -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-<GOOS>-<GOARCH`.
By default, `make build` builds an `ark` binary for `linux-amd64`.
To build for another platform, run `make build-<GOOS>-<GOARCH>`.
For example, to build for the Mac, run `make build-darwin-amd64`.
All binaries are placed in `_output/bin/<GOOS>/<GOARCH>`-- for example, `_output/bin/darwin/amd64/ark`.