-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
55 lines (41 loc) · 1.6 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
45
46
47
48
49
50
51
52
53
54
55
TOOLS_BIN_DIR ?= $(shell pwd)/tmp/bin
export PATH := $(TOOLS_BIN_DIR):$(PATH)
GO_BUILD_RECIPE=\
GOOS=$(GOOS) \
GOARCH=$(GOARCH) \
CGO_ENABLED=0 \
go build
GOLANGCILINTER_BINARY=$(TOOLS_BIN_DIR)/golangci-lint
MDOX_BINARY=$(TOOLS_BIN_DIR)/mdox
MDOX_VALIDATE_CONFIG?=.mdox.validate.yaml
TOOLING=$(MDOX_BINARY) $(GOLANGCILINTER_BINARY)
MD_FILES_TO_FORMAT=$(shell ls *.md) $(shell find Documentation -name "*.md")
.PHONY: docs
docs: $(MDOX_BINARY)
@echo ">> formatting and local/remote link check"
$(MDOX_BINARY) fmt --soft-wraps -l --links.localize.address-regex="https://prometheus-operator.dev/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)
.PHONY: check-docs
check-docs: $(MDOX_BINARY)
@echo ">> checking formatting and local/remote links"
$(MDOX_BINARY) fmt --soft-wraps --check -l --links.localize.address-regex="https://prometheus-operator.dev/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)
.PHONY: check-license
check-license:
./scripts/check-license.sh
.PHONY: check-golang
check-golang: $(GOLANGCILINTER_BINARY)
$(GOLANGCILINTER_BINARY) run
.PHONY: fix-golang
fix-golang: $(GOLANGCILINTER_BINARY)
$(GOLANGCILINTER_BINARY) run --fix
.PHONY: tidy
tidy:
go mod tidy -v
cd scripts && go mod tidy -v -modfile=go.mod -compat=1.18
.PHONY: poctl
poctl:
$(GO_BUILD_RECIPE) -o $@ main.go
$(TOOLS_BIN_DIR):
mkdir -p $(TOOLS_BIN_DIR)
$(TOOLING): $(TOOLS_BIN_DIR)
@echo Installing tools from scripts/tools.go
@cat scripts/tools.go | grep _ | awk -F'"' '{print $$2}' | GOBIN=$(TOOLS_BIN_DIR) xargs -tI % go install -mod=readonly -modfile=scripts/go.mod %