forked from ContentSquare/chproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (29 loc) · 915 Bytes
/
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
pkgs = $(shell go list ./...)
gofiles := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
BUILD_TAG = $(shell git tag --points-at HEAD)
BUILD_CONSTS = \
-X main.buildTime=`date -u '+%Y-%m-%d_%H:%M:%S'` \
-X main.buildRevision=`git rev-parse HEAD` \
-X main.buildTag=$(BUILD_TAG)
BUILD_OPTS = -ldflags="$(BUILD_CONSTS)" -gcflags="-trimpath=$(GOPATH)/src"
.PHONY: update format build test run lint reconfigure clean release-build release
format:
go fmt $(pkgs)
gofmt -w -s $(gofiles)
build:
go build
test: build
go test -race $(pkgs)
run: build
./chproxy -config=testdata/http.yml
lint:
go vet $(pkgs)
go list ./... | grep -v /vendor/ | xargs -n1 golint
reconfigure:
kill -HUP `pidof chproxy`
clean:
rm -f chproxy
release-build:
GOOS=linux GOARCH=amd64 go build $(BUILD_OPTS)
release: format lint test clean release-build
tar czf chproxy-linux-amd64-$(BUILD_TAG).tar.gz chproxy