Skip to content

Commit 2844caa

Browse files
committed
Makefile: support overriding of CC and CARGO for catching unintended builds.
For CI we want to make sure we don't rebuild. CC=false doesn't work because we reply on the output of "$CC -dumpmachine" for the external build directory. So we would use: make CC=devtools/cc-nobuild CARGO=false Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 0ece9f0 commit 2844caa

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ECHO := echo
2121
SUPPRESS_OUTPUT :=
2222
endif
2323

24+
CARGO := cargo
2425
DISTRO=$(shell lsb_release -is 2>/dev/null || echo unknown)-$(shell lsb_release -rs 2>/dev/null || echo unknown)
2526
OS=$(shell uname -s)
2627
ARCH=$(shell uname -m)

cln-rpc/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ DEFAULT_TARGETS += $(CLN_RPC_EXAMPLES) $(CLN_RPC_GENALL)
99
MSGGEN_GENALL += $(CLN_RPC_GENALL)
1010

1111
target/${RUST_PROFILE}/examples/cln-rpc-getinfo: ${CLN_RPC_SOURCES} cln-rpc/examples/getinfo.rs
12-
cargo build ${CARGO_OPTS} --example cln-rpc-getinfo
12+
$(CARGO) build ${CARGO_OPTS} --example cln-rpc-getinfo
1313

1414
target/${RUST_PROFILE}/examples/cln-plugin-startup: ${CLN_RPC_SOURCES} plugins/examples/cln-plugin-startup.rs
15-
cargo build ${CARGO_OPTS} --example cln-plugin-startup
15+
$(CARGO) build ${CARGO_OPTS} --example cln-plugin-startup
1616

1717
target/${RUST_PROFILE}/examples/cln-plugin-reentrant: ${CLN_RPC_SOURCES} plugins/examples/cln-plugin-reentrant.rs
18-
cargo build ${CARGO_OPTS} --example cln-plugin-reentrant
18+
$(CARGO) build ${CARGO_OPTS} --example cln-plugin-reentrant
1919

2020

2121
cln-rpc-all: ${CLN_RPC_GENALL} ${CLN_RPC_EXAMPLES}

devtools/cc-nobuild

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
# Version of CC which only supports -dumpmachine (for external/Makefile), and fails otherwise
3+
set -e
4+
5+
if [ x"$*" = x"-dumpmachine" ]; then
6+
CC="$(grep ^CC= config.vars | cut -d= -f2-)"
7+
exec ${CC:=cc} "$@"
8+
fi
9+
exit 1

plugins/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile config.vars
237237
@$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(PLUGIN_BASES:%=\"%\",) NULL };" > $@)
238238

239239
$(RUST_TARGET_DIR)/examples/cln-subscribe-wildcard: ${CLN_PLUGIN_SRC} plugins/examples/cln-subscribe-wildcard.rs
240-
cargo build ${CARGO_OPTS} --example cln-subscribe-wildcard
240+
$(CARGO) build ${CARGO_OPTS} --example cln-subscribe-wildcard
241241

242242
CLN_PLUGIN_EXAMPLES := \
243243
$(RUST_TARGET_DIR)/examples/cln-plugin-startup \
@@ -253,17 +253,17 @@ CLN_WSS_PROXY_PLUGIN_SRC = $(shell find plugins/wss-proxy-plugin/src -name "*.rs
253253
CLN_BIP353_PLUGIN_SRC = $(shell find plugins/bip353-plugin/src -name "*.rs")
254254

255255
$(RUST_TARGET_DIR)/cln-grpc: ${CLN_PLUGIN_SRC} ${CLN_GRPC_PLUGIN_SRC} $(MSGGEN_GENALL) $(MSGGEN_GEN_ALL)
256-
cargo build ${CARGO_OPTS} --bin cln-grpc
256+
$(CARGO) build ${CARGO_OPTS} --bin cln-grpc
257257
$(RUST_TARGET_DIR)/clnrest: ${CLN_REST_PLUGIN_SRC}
258-
cargo build ${CARGO_OPTS} --bin clnrest
258+
$(CARGO) build ${CARGO_OPTS} --bin clnrest
259259
$(RUST_TARGET_DIR)/cln-lsps-client: ${CLN_LSPS_PLUGIN_SRC}
260-
cargo build ${CARGO_OPTS} --bin cln-lsps-client
260+
$(CARGO) build ${CARGO_OPTS} --bin cln-lsps-client
261261
$(RUST_TARGET_DIR)/cln-lsps-service: ${CLN_LSPS_PLUGIN_SRC}
262-
cargo build ${CARGO_OPTS} --bin cln-lsps-service
262+
$(CARGO) build ${CARGO_OPTS} --bin cln-lsps-service
263263
$(RUST_TARGET_DIR)/wss-proxy: ${CLN_WSS_PROXY_PLUGIN_SRC}
264-
cargo build ${CARGO_OPTS} --bin wss-proxy
264+
$(CARGO) build ${CARGO_OPTS} --bin wss-proxy
265265
$(RUST_TARGET_DIR)/cln-bip353: ${CLN_BIP353_PLUGIN_SRC}
266-
cargo build ${CARGO_OPTS} --bin cln-bip353
266+
$(CARGO) build ${CARGO_OPTS} --bin cln-bip353
267267

268268
ifneq ($(RUST),0)
269269
include plugins/rest-plugin/Makefile

0 commit comments

Comments
 (0)