Skip to content

Commit a1d8d79

Browse files
thibault-martinezThoralf-MAlex6323
authored
chore(makefile): cleaner and less verbose output (#181)
* chore(makefile): cleaner and less verbose output * log examples being run * nit * use printf instead of echo * add newline after example name --------- Co-authored-by: Thoralf Müller <[email protected]> Co-authored-by: /alex/ <[email protected]>
1 parent 202285b commit a1d8d79

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

Makefile

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ clean-all: clean ## Clean all generated files, including those ignored by Git. F
6464

6565
.PHONY: bindings
6666
bindings: ## Build all bindings
67-
$(MAKE) go
68-
$(MAKE) kotlin
69-
$(MAKE) python
67+
@$(MAKE) go
68+
@$(MAKE) kotlin
69+
@$(MAKE) python
7070

7171
.PHONY: bindings-examples
7272
bindings-examples: ## Run all bindings examples
73-
$(MAKE) go-examples
74-
$(MAKE) kotlin-examples
75-
$(MAKE) python-examples
73+
@$(MAKE) go-examples
74+
@$(MAKE) kotlin-examples
75+
@$(MAKE) python-examples
7676

7777
.PHONY: bindings-example
7878
bindings-example: ## Run a specific example for all bindings. Usage: make bindings-example example
79-
$(MAKE) go-example $(word 2,$(MAKECMDGOALS))
80-
$(MAKE) kotlin-example $(word 2,$(MAKECMDGOALS))
81-
$(MAKE) python-example $(word 2,$(MAKECMDGOALS))
79+
@$(MAKE) go-example $(word 2,$(MAKECMDGOALS))
80+
@$(MAKE) kotlin-example $(word 2,$(MAKECMDGOALS))
81+
@$(MAKE) python-example $(word 2,$(MAKECMDGOALS))
8282

8383
# Build ffi crate and detect platform
8484
define build_binding
@@ -93,18 +93,21 @@ endef
9393

9494
.PHONY: go
9595
go: ## Build Go bindings
96-
$(build_binding) \
96+
@printf "Building Go bindings...\n"
97+
@$(build_binding) \
9798
uniffi-bindgen-go --library target/release/libiota_sdk_ffi$${LIB_EXT} --out-dir bindings/go --no-format || exit $$?
9899

99100
.PHONY: kotlin
100101
kotlin: ## Build Kotlin bindings
101-
$(build_binding) \
102+
@printf "Building Kotlin bindings...\n"
103+
@$(build_binding) \
102104
cargo run --bin iota_sdk_bindings -- generate --library "target/release/libiota_sdk_ffi$${LIB_EXT}" --language kotlin --out-dir bindings/kotlin/lib --no-format -c bindings/kotlin/uniffi.toml || exit $$?; \
103105
cp target/release/libiota_sdk_ffi$${LIB_EXT} bindings/kotlin/lib/
104106

105107
.PHONY: python
106108
python: ## Build Python bindings
107-
$(build_binding) \
109+
@printf "Building Python bindings...\n"
110+
@$(build_binding) \
108111
cargo run --bin iota_sdk_bindings -- generate --library "target/release/libiota_sdk_ffi$${LIB_EXT}" --language python --out-dir bindings/python/lib --no-format || exit $$?; \
109112
cp target/release/libiota_sdk_ffi$${LIB_EXT} bindings/python/lib/
110113

@@ -113,7 +116,8 @@ go-example: ## Run a specific Go example. Usage: make go-example example
113116
%:
114117
@true
115118
go-example:
116-
cd bindings/go/examples; \
119+
@printf "\nRunning Go example \"$(word 2,$(MAKECMDGOALS))\"\n"
120+
@cd bindings/go/examples; \
117121
LD_LIBRARY_PATH="../../../target/release" CGO_LDFLAGS="-liota_sdk_ffi -L../../../target/release" go run $(word 2,$(MAKECMDGOALS)).go || exit $$?; \
118122
cd -
119123

@@ -128,7 +132,8 @@ kotlin-example: ## Run a specific Kotlin example. Usage: make kotlin-example exa
128132
%:
129133
@true
130134
kotlin-example:
131-
cd bindings/kotlin; \
135+
@printf "\nRunning Kotlin example \"$(word 2,$(MAKECMDGOALS))" \n \"
136+
@cd bindings/kotlin; \
132137
./gradlew build clean || exit $$?; \
133138
LD_LIBRARY_PATH=./lib ./gradlew example -Pexample=$(word 2,$(MAKECMDGOALS)) -q || exit $$?; \
134139
cd -
@@ -144,7 +149,8 @@ python-example: ## Run a specific Python example. Usage: make python-example exa
144149
%:
145150
@true
146151
python-example:
147-
PYTHONPATH=bindings/python python3 bindings/python/examples/$(word 2,$(MAKECMDGOALS)).py || exit $$?;
152+
@printf "\nRunning Python example \"$(word 2,$(MAKECMDGOALS))\"\n"
153+
@PYTHONPATH=bindings/python python3 bindings/python/examples/$(word 2,$(MAKECMDGOALS)).py|| exit $$?;
148154

149155
.PHONY: python-examples
150156
python-examples: ## Run all Python bindings examples
@@ -154,5 +160,5 @@ python-examples: ## Run all Python bindings examples
154160

155161
.PHONY: help
156162
help: ## Show this help
157-
@echo "Available targets:"
163+
@printf "Available targets:\n"
158164
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)