-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (60 loc) · 3.01 KB
/
Makefile
File metadata and controls
74 lines (60 loc) · 3.01 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
.PHONY: all build build-pi test lint fmt tidy clean docs docs-check check-registration install-hooks sync-agent-docs
# Build both binaries for the current platform.
all: tidy fmt lint test build docs-check check-registration
VERSION ?= $(shell git describe --tags --always --dirty)
LDFLAGS_TASK := -ldflags "-X github.com/propifly/primkit/taskprim/internal/cli.Version=$(VERSION)"
LDFLAGS_STATE := -ldflags "-X github.com/propifly/primkit/stateprim/internal/cli.Version=$(VERSION)"
LDFLAGS_KNOW := -ldflags "-X github.com/propifly/primkit/knowledgeprim/internal/cli.Version=$(VERSION)"
LDFLAGS_QUEUE := -ldflags "-X github.com/propifly/primkit/queueprim/internal/cli.Version=$(VERSION)"
build:
cd taskprim && go build $(LDFLAGS_TASK) -o ../bin/taskprim ./cmd/taskprim
cd stateprim && go build $(LDFLAGS_STATE) -o ../bin/stateprim ./cmd/stateprim
cd knowledgeprim && go build $(LDFLAGS_KNOW) -o ../bin/knowledgeprim ./cmd/knowledgeprim
cd queueprim && go build $(LDFLAGS_QUEUE) -o ../bin/queueprim ./cmd/queueprim
# Cross-compile for Raspberry Pi (ARM64 Linux).
build-pi:
cd taskprim && GOOS=linux GOARCH=arm64 go build $(LDFLAGS_TASK) -o ../bin/taskprim-linux-arm64 ./cmd/taskprim
cd stateprim && GOOS=linux GOARCH=arm64 go build $(LDFLAGS_STATE) -o ../bin/stateprim-linux-arm64 ./cmd/stateprim
cd knowledgeprim && GOOS=linux GOARCH=arm64 go build $(LDFLAGS_KNOW) -o ../bin/knowledgeprim-linux-arm64 ./cmd/knowledgeprim
cd queueprim && GOOS=linux GOARCH=arm64 go build $(LDFLAGS_QUEUE) -o ../bin/queueprim-linux-arm64 ./cmd/queueprim
test:
cd primkit && go test -v -race -count=1 ./...
cd taskprim && go test -v -race -count=1 ./...
cd stateprim && go test -v -race -count=1 ./...
cd knowledgeprim && go test -v -race -count=1 ./...
cd queueprim && go test -v -race -count=1 ./...
lint:
cd primkit && golangci-lint run ./...
cd taskprim && golangci-lint run ./...
cd stateprim && golangci-lint run ./...
cd knowledgeprim && golangci-lint run ./...
cd queueprim && golangci-lint run ./...
fmt:
cd primkit && gofumpt -w .
cd taskprim && gofumpt -w .
cd stateprim && gofumpt -w .
cd knowledgeprim && gofumpt -w .
cd queueprim && gofumpt -w .
tidy:
cd primkit && go mod tidy
# go mod tidy adds primkit (workspace-local private module) to go.mod in each prim;
# strip it so CI doesn't try to download/verify the workspace-local module version.
for prim in taskprim stateprim knowledgeprim queueprim; do \
cd $$prim && go mod tidy && go mod edit -droprequire=github.com/propifly/primkit/primkit && grep -v "propifly/primkit/primkit" go.sum > go.sum.tmp && mv go.sum.tmp go.sum || true && cd ..; \
done
clean:
rm -rf bin/
# Documentation generation
docs:
bash scripts/docgen.sh
docs-check:
bash scripts/docgen.sh --check
# Registration validation
check-registration:
bash scripts/check-registration.sh
# Install git hooks (run once after cloning)
install-hooks:
bash scripts/install-hooks.sh
# Package agent-facing docs into a distributable zip (run after 'make docs' when docs change)
sync-agent-docs:
bash scripts/sync-agent-docs.sh