-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (66 loc) · 2.58 KB
/
Copy pathMakefile
File metadata and controls
81 lines (66 loc) · 2.58 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
75
76
77
78
79
80
81
# Copyright 2025 Deutsche Telekom IT GmbH
#
# SPDX-License-Identifier: Apache-2.0
# Root Makefile — delegates to per-module Makefiles.
# Usage:
# make verify Run all pre-push checks
# make verify MODULES="gateway identity" Check specific modules
# make build-all Build all modules
# make test-all Test all modules
# make lint-all Lint all modules
# make tidy-all Run go mod tidy on all modules
SHELL := /usr/bin/env bash
.SHELLFLAGS := -e -o pipefail -c
# Discover Go modules that have a Makefile (excluding docs and tools)
MODULES ?= $(shell find . -name 'go.mod' -not -path './docs/*' -not -path '*/node_modules/*' -not -path './tools/*' -exec dirname {} \; | while read d; do [ -f "$$d/Makefile" ] && echo "$$d"; done | sed 's|^\./||' | sort)
##@ Verification
.PHONY: verify
verify: ## Run all pre-push checks (pre-commit, tidy, build, lint).
hack/verify.sh $(MODULES)
##@ Bulk operations
.PHONY: build-all
build-all: ## Build all modules.
@for mod in $(MODULES); do \
echo "=== $$mod: make build ===" && \
$(MAKE) -C $$mod build || exit 1; \
done
.PHONY: test-all
test-all: ## Test all modules.
@for mod in $(MODULES); do \
echo "=== $$mod: make test ===" && \
$(MAKE) -C $$mod test || exit 1; \
done
.PHONY: tidy-all
tidy-all: ## Run go mod tidy on all modules.
@for mod in $(MODULES); do \
echo "=== $$mod: go mod tidy ===" && \
cd $$mod && go mod tidy && cd $(CURDIR) || exit 1; \
done
.PHONY: lint-all
lint-all: ## Lint all modules.
@for mod in $(MODULES); do \
if grep -q '^lint:' $$mod/Makefile 2>/dev/null; then \
echo "=== $$mod: make lint ===" && \
$(MAKE) -C $$mod lint || exit 1; \
else \
echo "=== $$mod: SKIP (no lint target) ==="; \
fi; \
done
##@ CI scope
.PHONY: ci-graph
ci-graph: ## Regenerate the module dependency graph (.github/ci/module-graph.json).
.github/scripts/gen-module-graph.sh > .github/ci/module-graph.json
.PHONY: ci-graph-check
ci-graph-check: ## Verify the committed module dependency graph is up to date.
@tmp=$$(mktemp) && \
.github/scripts/gen-module-graph.sh > "$$tmp" && \
if ! diff -u .github/ci/module-graph.json "$$tmp"; then \
rm -f "$$tmp"; \
echo "ERROR: .github/ci/module-graph.json is stale; run 'make ci-graph' and commit the result." >&2; \
exit 1; \
fi; \
rm -f "$$tmp"
##@ General
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)