mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
Makefile: use grouped targets for recipes with multiple fixed outputs
See the section headed "Rules with Grouped Targets" on the Texinfo page `(make)Multiple Targets`. Without this fix, Make does not know that these recipes unconditionally make *all* of their named targets regardless of which target triggers their execution, and Make will blissfully execute multiple instances of any such recipe in parallel, not only wasting CPU cycles but potentially producing incorrect results if the recipe is not atomic in its effects on the file system. With this fix, Make understands that it need only execute such a recipe once to make all of its targets. In pursuit of the above, move and combine two redundant msggen recipes into the top-level Makefile, and populate its grouped targets from the subordinate Makefiles. Changelog-None
This commit is contained in:
parent
fdb676491f
commit
8d737cc4bf
3 changed files with 6 additions and 6 deletions
5
Makefile
5
Makefile
|
@ -363,13 +363,16 @@ ifneq ($(RUST),0)
|
|||
include cln-rpc/Makefile
|
||||
include cln-grpc/Makefile
|
||||
|
||||
$(MSGGEN_GENALL)&: doc/schemas/*.request.json doc/schemas/*.schema.json
|
||||
PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
|
||||
|
||||
GRPC_GEN = contrib/pyln-testing/pyln/testing/node_pb2.py \
|
||||
contrib/pyln-testing/pyln/testing/node_pb2_grpc.py \
|
||||
contrib/pyln-testing/pyln/testing/primitives_pb2.py
|
||||
|
||||
ALL_TEST_GEN += $(GRPC_GEN)
|
||||
|
||||
$(GRPC_GEN): cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
|
||||
$(GRPC_GEN)&: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
|
||||
python -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=contrib/pyln-testing/pyln/testing/ --grpc_python_out=contrib/pyln-testing/pyln/testing/ --experimental_allow_proto3_optional
|
||||
python -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=contrib/pyln-testing/pyln/testing/ --experimental_allow_proto3_optional
|
||||
# The compiler assumes that the proto files are in the same
|
||||
|
|
|
@ -8,7 +8,6 @@ CLN_GRPC_GENALL = cln-grpc/proto/node.proto \
|
|||
|
||||
DEFAULT_TARGETS += $(CLN_GRPC_EXAMPLES) $(CLN_GRPC_GENALL)
|
||||
|
||||
$(CLN_GRPC_GENALL): $(JSON_SCHEMA)
|
||||
PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
|
||||
MSGGEN_GENALL += $(CLN_GRPC_GENALL)
|
||||
|
||||
cln-grpc-all: ${CLN_GRPC_GENALL} ${CLN_GRPC_EXAMPLES}
|
||||
|
|
|
@ -4,11 +4,9 @@ cln-rpc-wrongdir:
|
|||
CLN_RPC_EXAMPLES := target/${RUST_PROFILE}/examples/cln-rpc-getinfo
|
||||
CLN_RPC_GENALL = cln-rpc/src/model.rs
|
||||
CLN_RPC_SOURCES = $(shell find cln-rpc -name *.rs) ${CLN_RPC_GENALL}
|
||||
JSON_SCHEMAS = $(wildcard doc/schemas/*.request.json doc/schemas/*.schema.json)
|
||||
DEFAULT_TARGETS += $(CLN_RPC_EXAMPLES) $(CLN_RPC_GENALL)
|
||||
|
||||
$(CLN_RPC_GENALL): $(JSON_SCHEMAS)
|
||||
PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
|
||||
MSGGEN_GENALL += $(CLN_RPC_GENALL)
|
||||
|
||||
target/${RUST_PROFILE}/examples/cln-rpc-getinfo: $(shell find cln-rpc -name *.rs)
|
||||
cargo build ${CARGO_OPTS} --example cln-rpc-getinfo
|
||||
|
|
Loading…
Add table
Reference in a new issue