Skip to content

Commit

Permalink
Merge pull request #711 from skriss/make-local
Browse files Browse the repository at this point in the history
Bring back 'make local'
  • Loading branch information
carlisia authored Aug 9, 2018
2 parents 65cd5c6 + 6e53aa0 commit 23d570e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'"
Expand Down
4 changes: 2 additions & 2 deletions docs/build-from-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down

0 comments on commit 23d570e

Please sign in to comment.