Skip to content

Commit b70f783

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 3a3b1f8 commit b70f783

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ECHO := echo
1515
SUPPRESS_OUTPUT :=
1616
endif
1717

18+
CARGO := cargo
1819
DISTRO=$(shell lsb_release -is 2>/dev/null || echo unknown)-$(shell lsb_release -rs 2>/dev/null || echo unknown)
1920
OS=$(shell uname -s)
2021
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
@@ -241,7 +241,7 @@ plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile config.vars
241241
@$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(PLUGIN_BASES:%=\"%\",) NULL };" > $@)
242242

243243
$(RUST_TARGET_DIR)/examples/cln-subscribe-wildcard: ${CLN_PLUGIN_SRC} plugins/examples/cln-subscribe-wildcard.rs
244-
cargo build ${CARGO_OPTS} --example cln-subscribe-wildcard
244+
$(CARGO) build ${CARGO_OPTS} --example cln-subscribe-wildcard
245245

246246
CLN_PLUGIN_EXAMPLES := \
247247
$(RUST_TARGET_DIR)/examples/cln-plugin-startup \
@@ -257,17 +257,17 @@ CLN_WSS_PROXY_PLUGIN_SRC = $(shell find plugins/wss-proxy-plugin/src -name "*.rs
257257
CLN_BIP353_PLUGIN_SRC = $(shell find plugins/bip353-plugin/src -name "*.rs")
258258

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

272272
ifneq ($(RUST),0)
273273
include plugins/rest-plugin/Makefile

0 commit comments

Comments
 (0)