Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (39 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
51 lines (39 loc) · 1.52 KB
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
.PHONY: build install test vet tidy clean run codegen codegen-check docs
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w \
-X github.com/norcubeplatform/cli/internal/buildinfo.Version=$(VERSION) \
-X github.com/norcubeplatform/cli/internal/buildinfo.Commit=$(COMMIT) \
-X github.com/norcubeplatform/cli/internal/buildinfo.Date=$(DATE)
build:
go build -ldflags "$(LDFLAGS)" -o bin/norcube ./cmd/norcube
install:
go install -ldflags "$(LDFLAGS)" ./cmd/norcube
run:
go run ./cmd/norcube $(ARGS)
test:
go test ./...
vet:
go vet ./...
tidy:
go mod tidy
clean:
rm -rf bin dist
# Backend monorepo (or a directory with the same apps/<app>/docs/<file>
# layout, e.g. a published spec artifact). Override with MONO=...
MONO ?= ../backend-mono
# Regenerate every API client listed in internal/registry/services.yaml.
# oapi-codegen is pinned in tools/codegen; no global install needed.
codegen:
go run ./tools/codegen -mono $(MONO)
# Fail when the generated clients don't match the specs in MONO (CI's
# drift check runs this).
codegen-check: codegen
@git diff --exit-code -- specs internal/api || { \
echo "Generated clients are out of date. Run 'make codegen' and commit the result."; exit 1; }
# Regenerate the command reference (MDX) in the docs site checkout. CI
# fails when the committed reference differs (see .github/workflows).
DOCS ?= ../docs
docs:
go run ./tools/gendocs -mdx $(DOCS)/content/docs/platform/cli-reference