forked from Azure/notation-azure-kv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (35 loc) · 1.31 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
MODULE = github.com/Azure/notation-azure-kv
COMMANDS = notation-azure-kv
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
BUILD_METADATA =
ifeq ($(GIT_TAG),) # unreleased build
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "unreleased")
BUILD_METADATA = $(GIT_COMMIT).$(GIT_STATUS)
endif
LDFLAGS = -X $(MODULE)/internal/version.BuildMetadata=$(BUILD_METADATA)
GO_BUILD_FLAGS = --ldflags="$(LDFLAGS)"
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
.PHONY: all
all: build
.PHONY: FORCE
FORCE:
bin/%: cmd/% FORCE
go build $(GO_BUILD_FLAGS) -o $@ ./$<
.PHONY: download
download: ## download dependencies via go mod
go mod download
.PHONY: build
build: $(addprefix bin/,$(COMMANDS)) ## builds binaries
.PHONY: clean
clean:
git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf
.PHONY: test
test:
go test ./... -coverprofile cover.out
.PHONY: install
install: bin/notation-azure-kv ## installs the plugin
mkdir -p ~/.config/notation/plugins/azure-kv/
cp bin/notation-azure-kv ~/.config/notation/plugins/azure-kv/