Skip to content

Commit

Permalink
Merge pull request #20 from CircleCI-Public/use-build-service
Browse files Browse the repository at this point in the history
Makefile tidy up
  • Loading branch information
Zachary Scott authored Jul 17, 2018
2 parents 0affa63 + 9da110f commit 50017f0
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -39,7 +26,7 @@ cover:

.PHONY: lint
lint:
gometalinter --deadline 60s --vendor ./...
gometalinter ./...

.PHONY: doc
doc:
Expand All @@ -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:

0 comments on commit 50017f0

Please sign in to comment.