-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (39 loc) · 1.39 KB
/
Makefile
File metadata and controls
48 lines (39 loc) · 1.39 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
CARTOGRAPHER_DIR := third_party/cartographer/mapper-core/cartographer
CARTOGRAPHER_LIB := $(CARTOGRAPHER_DIR)/target/release/libcartographer.a
BIN_DIR := bin
.PHONY: build build-cartographer build-fast test test-cartographer lint clean
## Build CKB with Cartographer integration (default)
build: build-cartographer
@mkdir -p $(BIN_DIR)
go build -tags cartographer -o $(BIN_DIR)/ckb ./cmd/ckb/...
@echo "Built: $(BIN_DIR)/ckb (with Cartographer)"
## Build the Cartographer static library (requires Rust toolchain)
build-cartographer:
@echo "Building Cartographer static library..."
@cd $(CARTOGRAPHER_DIR) && cargo build --release
@echo "Library: $(CARTOGRAPHER_LIB)"
## Build without Cartographer (no Rust toolchain required — for CI and contributors)
build-fast:
@mkdir -p $(BIN_DIR)
go build -o $(BIN_DIR)/ckb ./cmd/ckb/...
@echo "Built: $(BIN_DIR)/ckb (without Cartographer)"
## Run all tests
test:
go test ./...
## Run all tests with Cartographer compiled in
test-cartographer: build-cartographer
go test -tags cartographer ./...
## Lint
lint:
golangci-lint run ./...
## Remove build artifacts
clean:
rm -rf $(BIN_DIR)
## Check whether the Cartographer library is present
check-cartographer:
@if [ -f "$(CARTOGRAPHER_LIB)" ]; then \
echo "Cartographer library found: $(CARTOGRAPHER_LIB)"; \
else \
echo "Cartographer library NOT found. Run: make build-cartographer"; \
exit 1; \
fi