diff --git a/Makefile b/Makefile index 6e25fbd62..1715600a3 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,20 @@ -VERSION=0.1 +default: build -GOFILES = $(shell find . -name '*.go' -not -path './vendor/*') +GOOS=$(shell go env GOOS) +GOARCH=$(shell go env GOARCH) -OS ?= $(shell uname) - -CLIPATH=github.com/CircleCI-Public/circleci-cli - -EXECUTABLE=circleci-cli -BUILD_DIR=build - -.PHONY: build build: -ifeq ($(OS), Darwin) - GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/darwin/amd64/$(EXECUTABLE) -else ifeq ($(OS), Linux) - GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/linux/amd64/$(EXECUTABLE) -endif + go build -o build/$(GOOS)/$(GOARCH)/circleci -.PHONY: build/* -$(BUILD_DIR)/%/amd64/$(EXECUTABLE): $(GOFILES) - GOOS=$* GOARCH=amd64 CGO_ENABLED=0 go build $(LDFLAGS) -o $(BUILD_DIR)/$*/amd64/$(EXECUTABLE) . +build-all: build/linux/amd64/circleci build/darwin/amd64/circleci -.PHONY: build-all -build-all: $(BUILD_DIR)/darwin/amd64/$(EXECUTABLE) $(BUILD_DIR)/linux/amd64/$(EXECUTABLE) +build/%/amd64/circleci: always + GOOS=$* GOARCH=amd64 go build -v -o $@ . .PHONY: clean clean: go clean - rm -rf $(BUILD_DIR) + rm -rf build .PHONY: test test: @@ -39,7 +26,7 @@ cover: .PHONY: lint lint: - gometalinter --deadline 60s --vendor ./... + gometalinter ./... .PHONY: doc doc: @@ -50,3 +37,6 @@ dev: go get golang.org/x/tools/cmd/godoc go get -u github.com/alecthomas/gometalinter gometalinter --install + +.PHONY: always +always: