-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (57 loc) · 2.65 KB
/
Makefile
File metadata and controls
73 lines (57 loc) · 2.65 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
###################################################
### Lumera SDK-Go Makefile ###
###################################################
# Go SDK + examples for the Lumera blockchain.
# Run `make` (or `make sdk` / `make examples`) to build; `make help` lists targets.
.PHONY: help all sdk build examples example-% test lint clean tidy deps install install-tools
GO ?= go
GOLANGCI_LINT ?= golangci-lint
BUILD_DIR ?= build
EXAMPLES ?= action-approve cascade-upload cascade-download query-actions claim-tokens ica-request-tx ica-approve-tx ica-request-verify
# Default target: build SDK and examples
all: sdk examples ## Build SDK (compile packages) and all examples
help: ## Display this help screen
@grep -h -E '^[a-zA-Z0-9_/-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-28s\033[0m %s\n", $$1, $$2}'
# SDK/library compile check (Go libs are compiled as part of go build; no artifact)
sdk: go.sum ## Compile all packages in the module (verifies SDK builds)
@echo "Building Lumera SDK-go (library packages)..."
@$(GO) build ./...
@echo "SDK build completed successfully."
# Alias for backward compatibility
build: sdk ## Alias for sdk
go.sum: go.mod
@echo "Verifying and tidying go modules..."
@$(GO) mod verify
@$(GO) mod tidy
@touch go.sum
# Examples to build (main packages under ./examples)
examples: $(EXAMPLES:%=example-%) ## Build all example binaries into ./build
@echo "Examples built into $(BUILD_DIR)/"
# Build a single example: make example-cascade-upload
example-%: ## Build a single example binary into ./build (usage: make example-cascade-upload)
@mkdir -p $(BUILD_DIR)
@echo "Building $*..."
@$(GO) build -o $(BUILD_DIR)/$* ./examples/$*
test: ## Run tests with race detector and coverage
@echo "Running tests..."
@$(GO) test -v -race -coverprofile=coverage.out ./...
@$(GO) tool cover -html=coverage.out -o coverage.html
lint: ## Run linters (requires golangci-lint)
@echo "Running linters..."
@$(GOLANGCI_LINT) run ./... --timeout=5m
install-tools: ## Install required developer tools
@echo "Installing golangci-lint (latest)..."
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@echo "Tool installation complete."
tidy: ## Tidy go modules
@$(GO) mod tidy
deps: ## Update dependencies (minor/patch) then tidy
@$(GO) get -u ./...
@$(GO) mod tidy
install: ## Install all module binaries (none if project has only libraries and examples)
@echo "Installing binaries (if any main packages outside examples)..."
@$(GO) install ./...
clean: ## Clean build artifacts and test caches
@echo "Cleaning..."
@rm -rf $(BUILD_DIR) coverage.out coverage.html
@$(GO) clean -cache -testcache