forked from grafana/grizzly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (23 loc) · 764 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
.PHONY: lint test static install uninstall cross
VERSION := $(shell git describe --tags --dirty --always)
BIN_DIR := $(GOPATH)/bin
GOX := $(BIN_DIR)/gox
lint:
test -z $$(gofmt -s -l cmd/ pkg/)
go vet ./...
test:
go test ./...
# Compilation
dev:
go build -ldflags "-X main.Version=dev-${VERSION}" ./cmd/grr
LDFLAGS := '-s -w -extldflags "-static" -X main.Version=${VERSION}'
static:
CGO_ENABLED=0 GOOS=linux go build -ldflags=${LDFLAGS} ./cmd/grr
install:
CGO_ENABLED=0 go install -ldflags=${LDFLAGS} ./cmd/grr
uninstall:
go clean -i ./cmd/grr
$(GOX):
go get -u github.com/mitchellh/gox
cross: $(GOX)
CGO_ENABLED=0 gox -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}" -ldflags=${LDFLAGS} -arch="amd64 arm64 arm" -os="linux" -osarch="darwin/amd64" ./cmd/g