-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
42 lines (29 loc) · 971 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
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0
GO ?= go
# v0.5.1 when building from tag (release)
# v0.5.1-1-gcf79160 when building without tag (development)
version := $(shell git describe --tags)
commit := $(shell git rev-parse HEAD)
build := github.com/ramendr/ramenctl/pkg/build
# % go build -ldflags="-help"
# -X definition
# add string value definition of the form importpath.name=value
ldflags := -X '$(build).Version=$(version)' \
-X '$(build).Commit=$(commit)'
.PHONY: ramenctl examples test clean coverage lint fmt
all: ramenctl examples
ramenctl:
CGO_ENABLED=0 $(GO) build -ldflags="$(ldflags)" cmd/ramenctl.go
examples:
$(GO) build -o examples/odf examples/odf.go
fmt:
gofmt -s -w $(shell find . -name '*.go')
lint:
golangci-lint run ./...
test:
$(GO) test --coverprofile cover.out -ldflags="$(ldflags)" -v ./...
coverage:
$(GO) tool cover -html=cover.out
clean:
rm -f ramenctl examples/odf