-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
53 lines (42 loc) · 1.2 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
BINARY=gprobe
VERSION=$(shell git describe 2>/dev/null || echo "0.0.0")
RELEASE=release
RELEASE_FORMAT=${BINARY}-${GOOS}-${GOARCH}-${VERSION}.tar.gz
default: bin
.PHONY: bin
bin: deps ${BINARY}
.PHONY: release
release: release/gprobe-linux-amd64-${VERSION}.tar.gz
release: release/gprobe-linux-386-${VERSION}.tar.gz
release: release/gprobe-darwin-amd64-${VERSION}.tar.gz
release: release/gprobe-windows-amd64-${VERSION}.tar.gz
.PHONY: release-dir
release-dir:
mkdir -p ${RELEASE}
${RELEASE}/%-${VERSION}.tar.gz: | release-dir
GOOS=$(shell echo $* | cut -d '-' -f 2) GOARCH=$(shell echo $* | cut -d '-' -f 3) \
go build -ldflags="-s -w -X main.version=${VERSION} -v" -o ${RELEASE}/${BINARY}
tar -C ${RELEASE} -czf $@ ${BINARY}
rm ${RELEASE}/${BINARY}
${BINARY}:
go build -ldflags="-s -w -X main.version=${VERSION} -v" -o $@
.PHONY: lint
lint:
go get -u github.com/golang/lint/golint
golint -set_exit_status ./...
.PHONY: test
test:
go test -v $(go list ./... | grep -v /acctest/)
.PHONY: acctest
acctest: ${BINARY}
go test -v ./acctest/... -args -gprobe `pwd`/${BINARY}
.PHONY: deps
deps:
go get -u ./...
.PHONY: test-deps
test-deps:
go get -t -u ./...
.PHONY: clean
clean:
rm -f ${BINARY}
rm -rf ${RELEASE}