@@ -5,6 +5,7 @@ BINARY_NAME = axoned
5
5
TARGET_FOLDER = target
6
6
DIST_FOLDER = $(TARGET_FOLDER ) /dist
7
7
RELEASE_FOLDER = $(TARGET_FOLDER ) /release
8
+ TOOLS_FOLDER = $(TARGET_FOLDER ) /tools
8
9
CMD_ROOT :=./cmd/${BINARY_NAME}
9
10
LEDGER_ENABLED ?= true
10
11
@@ -19,6 +20,12 @@ DOCKER_BUILDX_BUILDER = axone-builder
19
20
DOCKER_IMAGE_MARKDOWNLINT = thegeeklab/markdownlint-cli:0.32.2
20
21
DOCKER_IMAGE_GOTEMPLATE = hairyhenderson/gomplate:v3.11.3-alpine
21
22
23
+ # Tools
24
+ TOOL_TPARSE_NAME := tparse
25
+ TOOL_TPARSE_VERSION := v0.16.0
26
+ TOOL_TPARSE_PKG := github.com/mfridman/$(TOOL_TPARSE_NAME ) @$(TOOL_TPARSE_VERSION )
27
+ TOOL_TPARSE_BIN := ${TOOLS_FOLDER}/$(TOOL_TPARSE_NAME ) /$(TOOL_TPARSE_VERSION ) /$(TOOL_TPARSE_NAME )
28
+
22
29
# Some colors
23
30
COLOR_GREEN = $(shell tput -Txterm setaf 2)
24
31
COLOR_YELLOW = $(shell tput -Txterm setaf 3)
@@ -111,7 +118,6 @@ endif
111
118
.PHONY : all
112
119
all : help
113
120
114
- # # Lint:
115
121
.PHONY : lint
116
122
lint : lint-go lint-proto # # Lint all available linters
117
123
@@ -190,9 +196,9 @@ install: ## Install node executable
190
196
test : test-go # # Pass all the tests
191
197
192
198
.PHONY : test-go
193
- test-go : build # # Pass the test for the go source code
199
+ test-go : $( TOOL_TPARSE_BIN ) build # # Pass the test for the go source code
194
200
@echo " ${COLOR_CYAN} 🧪 Passing go tests${COLOR_RESET} "
195
- @go test -v -coverprofile ./target/coverage.txt ./...
201
+ @go test -v -coverprofile ./target/coverage.txt ./... -json | $( TOOL_TPARSE_BIN )
196
202
197
203
# # Chain:
198
204
chain-init : build # # Initialize the blockchain with default settings.
@@ -409,6 +415,18 @@ ensure-buildx-builder:
409
415
@docker buildx ls | sed ' 1 d' | cut -f 1 -d ' ' | grep -q ${DOCKER_BUILDX_BUILDER} || \
410
416
docker buildx create --name ${DOCKER_BUILDX_BUILDER}
411
417
418
+ # # Dependencies:
419
+ .PHONY : deps
420
+ deps : deps-$(TOOL_TPARSE_NAME ) # # Install all the dependencies (tools, etc.)
421
+
422
+ .PHONY : deps-$(TOOL_TPARSE_NAME )
423
+ deps-tparse : $(TOOL_TPARSE_BIN ) # # Install $TOOL_TPARSE_NAME $TOOL_TPARSE_VERSION ($TOOL_TPARSE_PKG)
424
+
425
+ $(TOOL_TPARSE_BIN ) :
426
+ @echo " ${COLOR_CYAN} 📦 Installing ${COLOR_GREEN} $( TOOL_TPARSE_NAME) @$( TOOL_TPARSE_VERSION) ${COLOR_CYAN} ...${COLOR_RESET} "
427
+ @mkdir -p $(dir $(TOOL_TPARSE_BIN ) )
428
+ @GOBIN=$(dir $(abspath $(TOOL_TPARSE_BIN ) ) ) go install $(TOOL_TPARSE_PKG )
429
+
412
430
# # Help:
413
431
.PHONY : help
414
432
help : # # Show this help.
@@ -417,10 +435,14 @@ help: ## Show this help.
417
435
@echo ' ${COLOR_YELLOW}make${COLOR_RESET} ${COLOR_GREEN}<target>${COLOR_RESET}'
418
436
@echo ' '
419
437
@echo ' Targets:'
420
- @awk ' BEGIN {FS = ":.*?## "} { \
438
+ @$(foreach V,$(sort $(.VARIABLES ) ) , \
439
+ $(if $(filter-out environment% default automatic,$(origin $V ) ) , \
440
+ $(if $(filter TOOL_% ,$V) , \
441
+ export $V =" $( $V ) " ; ))) \
442
+ awk ' BEGIN {FS = ":.*?## "} { \
421
443
if (/^[a-zA-Z_-]+:.*? # #.*$$/) {printf " ${COLOR_YELLOW}%-20s${COLOR_GREEN}%s${COLOR_RESET}\n", $$1, $$2} \
422
444
else if (/^# # .*$$/) {printf " ${COLOR_CYAN}%s${COLOR_RESET}\n", substr($$1,4)} \
423
- }' $(MAKEFILE_LIST)
445
+ }' $(MAKEFILE_LIST) | envsubst
424
446
@echo ' '
425
447
@echo ' This Makefile depends on ${COLOR_CYAN}docker${COLOR_RESET}. To install it, please follow the instructions:'
426
448
@echo ' - for ${COLOR_YELLOW}macOS${COLOR_RESET}: https://docs.docker.com/docker-for-mac/install/'
0 commit comments