-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
63 lines (49 loc) · 1.58 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
53
54
55
56
57
58
59
60
61
62
63
GO := go
GO_BUILDFLAGS ?= -v -ldflags "-s -w"
GO_TESTFLAGS ?= -v -cover
GO_GETFLAGS ?= -v
GO_VETFLAGS ?= -v -all -source -shadow=true -shadowstrict
GOFMT := gofmt
GOFMTFLAGS := -s -w -l
GOPATH := $(shell pwd)
PKGPATH := $(GOPATH)/src/local-ci
BINPATH := $(GOPATH)/bin
SRCS = $(PKGPATH)/main.go $(wildcard $(PKGPATH)/**/*.go)
.PHONY: verify
verify: fmt vet
.PHONY: build build/alpine build/darwin build/linux
build: build/alpine build/darwin build/linux build/windows
build/alpine: $(BINPATH)/alpine/local-ci
build/darwin: $(BINPATH)/darwin/local-ci
build/linux: $(BINPATH)/linux/local-ci
build/windows: $(BINPATH)/windows/local-ci
mv $< $<.exe
.PHONY: clean
clean:
rm -rf bin/ pkg/ src/github.com gopkk.in/
.PHONY: fmt
fmt:
@$(GOFMT) $(GOFMTFLAGS) $(PKGPATH)
.PHONY: vet
vet:
GOPATH=$(GOPATH) $(GO) vet $(GO_VETFLAGS) ./src/local-ci/...
.PHONY: test
test:
GOPATH=$(GOPATH) $(GO) test $(GO_TESTFLAGS) local-ci/...
.PHONY: vendor
vendor:
GOPATH=$(GOPATH) $(GO) get $(GO_GETFLAGS) ./src/local-ci/...
$(BINPATH)/%/local-ci: $(SRCS) vendor
mkdir -p $(dir $@)
GOPATH=$(GOPATH) GOOS=$(shell echo $* | sed s/alpine/linux/) $(GO) build $(GO_BUILDFLAGS) -o $@ $<
CHANGELOG.md: $(BINPATH)/clog .clog.toml
$<
$(BINPATH)/clog:
mkdir -p $(BINPATH)
ifeq ($(shell uname),Darwin)
wget -q -O [email protected] https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-$(shell uname -m)-apple-darwin.tar.gz
else
wget -q -O [email protected] https://github.com/clog-tool/clog-cli/releases/download/v0.9.3/clog-v0.9.3-$(shell uname -m)-unknown-linux-gnu.tar.gz
endif
tar xzvf [email protected] -C bin/
rm -f [email protected]