forked from CircleCI-Public/circleci-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (39 loc) · 1.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
VERSION=0.1
GOFILES = $(shell find . -name '*.go' -not -path './vendor/*')
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
.PHONY: build/*
$(BUILD_DIR)/%/amd64/$(EXECUTABLE): $(GOFILES)
GOOS=$* GOARCH=amd64 CGO_ENABLED=0 go build $(LDFLAGS) -o $(BUILD_DIR)/$*/amd64/$(EXECUTABLE) .
.PHONY: build-all
build-all: $(BUILD_DIR)/darwin/amd64/$(EXECUTABLE) $(BUILD_DIR)/linux/amd64/$(EXECUTABLE)
.PHONY: clean
clean:
go clean
rm -rf $(BUILD_DIR)
.PHONY: test
test:
go test -v -short ./...
.PHONY: cover
cover:
go test -race -coverprofile=coverage.txt ./...
.PHONY: lint
lint:
gometalinter --deadline 60s --vendor ./...
.PHONY: doc
doc:
godoc -http=:6060
.PHONY: dev
dev:
go get golang.org/x/tools/cmd/godoc
go get -u github.com/alecthomas/gometalinter
gometalinter --install