-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (45 loc) · 1.32 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
Name := recorder
Version := $(shell git describe --tags --abbrev=0)
OWNER := heptagon-inc
.DEFAULT_GOAL := help
## Setup
setup:
go get github.com/kardianos/govendor
go get github.com/Songmu/make2help/cmd/make2help
go get github.com/mitchellh/gox
## Install dependencies
deps: setup
govendor sync
## Initialize and Update dependencies
update: setup
rm -rf /vendor/vendor.json
govendor fetch +outside
## Vet
vet: setup
govendor vet +local
## Lint
lint: setup
go get github.com/golang/lint/golint
govendor vet +local
for pkg in $$(govendor list -p -no-status +local); do \
golint -set_exit_status $$pkg || exit $$?; \
done
## Run tests
test: deps
govendor test +local
## Build
build: deps
gox -osarch="darwin/amd64 linux/amd64" -ldflags="-X main.Version=$(Version) -X main.Name=$(Name)" -output="pkg/{{.OS}}_{{.Arch}}/$(Name)"
## Build
build-local: deps
go build -ldflags "-X main.Version=$(Version) -X main.Name=$(Name)" -o pkg/$(Name)
## Release
release: build
mkdir -p pkg/release
zip -j pkg/release/$(Name)_darwin_amd64.zip pkg/darwin_amd64/$(Name)
zip -j pkg/release/$(Name)_linux_amd64.zip pkg/linux_amd64/$(Name)
ghr -t ${GITHUB_TOKEN} -u $(OWNER) -r $(Name) --replace $(Version) pkg/release/
## Show help
help:
@make2help $(MAKEFILE_LIST)
.PHONY: setup deps update vet lint test build build-local release help