forked from gridscale/gscloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (23 loc) · 761 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
VERSION := $(shell if ! git describe --tags 2>/dev/null; then \
grep -Po '(?<=^VERSION=)v.*$$' $$PWD/RELEASE.txt; \
fi; \
)
GIT_COMMIT := $(shell if ! git rev-list -1 HEAD 2>/dev/null; then \
grep -Po '(?<=^GIT_COMMIT=)\w*$$' $$PWD/RELEASE.txt; \
fi; \
)
default: build
build:
go build -ldflags "-X github.com/gridscale/gscloud/cmd.GitCommit=$(GIT_COMMIT) -X github.com/gridscale/gscloud/cmd.Version=$(VERSION)"
build-debug:
go build \
-gcflags="all=-N -l" \
-ldflags "-X github.com/gridscale/gscloud/cmd.GitCommit=$(GIT_COMMIT) -X github.com/gridscale/gscloud/cmd.Version=$(VERSION)"
test: build
go test -coverprofile=cover.out ./...
go tool cover -func=cover.out
lint: build
staticcheck ./...
clean:
go clean
.PHONY: build test lint clean