Skip to content

Commit fee53f1

Browse files
committed
add makefile for tools to be built and installed
1 parent fdc59ab commit fee53f1

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include ./scripts/test.mk
33
include ./scripts/proto.mk
44
include ./scripts/utils.mk
55
include ./scripts/run.mk
6+
include ./tools/tools.mk
67

78
# Sets the default make target to `build`.
89
# Requires GNU Make >= v3.81.

tools/tools.mk

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# tools.mk - Build configuration for ev-node tools
2+
3+
# Tool names
4+
TOOLS := da-debug blob-decoder cache-analyzer
5+
6+
# Build directory
7+
TOOLS_BUILD_DIR := $(CURDIR)/build
8+
9+
# Version information (inherited from main build.mk if available)
10+
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
11+
GITSHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
12+
LDFLAGS ?= \
13+
-X main.Version=$(VERSION) \
14+
-X main.GitSHA=$(GITSHA)
15+
16+
# Individual tool build targets
17+
## build-tool-da-debug: Build da-debug tool
18+
build-tool-da-debug:
19+
@echo "--> Building da-debug tool"
20+
@mkdir -p $(TOOLS_BUILD_DIR)
21+
@cd tools/da-debug && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/da-debug .
22+
@echo "--> da-debug built: $(TOOLS_BUILD_DIR)/da-debug"
23+
.PHONY: build-tool-da-debug
24+
25+
## build-tool-blob-decoder: Build blob-decoder tool
26+
build-tool-blob-decoder:
27+
@echo "--> Building blob-decoder tool"
28+
@mkdir -p $(TOOLS_BUILD_DIR)
29+
@cd tools/blob-decoder && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/blob-decoder .
30+
@echo "--> blob-decoder built: $(TOOLS_BUILD_DIR)/blob-decoder"
31+
.PHONY: build-tool-blob-decoder
32+
33+
## build-tool-cache-analyzer: Build cache-analyzer tool
34+
build-tool-cache-analyzer:
35+
@echo "--> Building cache-analyzer tool"
36+
@mkdir -p $(TOOLS_BUILD_DIR)
37+
@cd tools/cache-analyzer && go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BUILD_DIR)/cache-analyzer .
38+
@echo "--> cache-analyzer built: $(TOOLS_BUILD_DIR)/cache-analyzer"
39+
.PHONY: build-tool-cache-analyzer
40+
41+
# Build all tools
42+
## build-tools: Build all tools
43+
build-tools: $(addprefix build-tool-, $(TOOLS))
44+
@echo "--> All tools built successfully!"
45+
.PHONY: build-tools
46+
47+
# Install individual tools
48+
## install-tool-da-debug: Install da-debug tool to Go bin
49+
install-tool-da-debug:
50+
@echo "--> Installing da-debug tool"
51+
@cd tools/da-debug && go install -ldflags "$(LDFLAGS)" .
52+
@echo "--> da-debug installed to Go bin"
53+
.PHONY: install-tool-da-debug
54+
55+
## install-tool-blob-decoder: Install blob-decoder tool to Go bin
56+
install-tool-blob-decoder:
57+
@echo "--> Installing blob-decoder tool"
58+
@cd tools/blob-decoder && go install -ldflags "$(LDFLAGS)" .
59+
@echo "--> blob-decoder installed to Go bin"
60+
.PHONY: install-tool-blob-decoder
61+
62+
## install-tool-cache-analyzer: Install cache-analyzer tool to Go bin
63+
install-tool-cache-analyzer:
64+
@echo "--> Installing cache-analyzer tool"
65+
@cd tools/cache-analyzer && go install -ldflags "$(LDFLAGS)" .
66+
@echo "--> cache-analyzer installed to Go bin"
67+
.PHONY: install-tool-cache-analyzer
68+
69+
# Install all tools
70+
## install-tools: Install all tools to Go bin
71+
install-tools: $(addprefix install-tool-, $(TOOLS))
72+
@echo "--> All tools installed successfully!"
73+
.PHONY: install-tools
74+
75+
# Clean built tools
76+
## clean-tools: Remove built tool binaries
77+
clean-tools:
78+
@echo "--> Cleaning built tools"
79+
@rm -f $(addprefix $(TOOLS_BUILD_DIR)/, $(TOOLS))
80+
@echo "--> Tools cleaned"
81+
.PHONY: clean-tools
82+
83+
# List available tools
84+
## list-tools: List all available tools
85+
list-tools:
86+
@echo "Available tools:"
87+
@for tool in $(TOOLS); do \
88+
echo " - $$tool"; \
89+
done
90+
.PHONY: list-tools

0 commit comments

Comments
 (0)