core-lightning/cln-grpc/Makefile
Matt Whitlock 8d737cc4bf 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
2023-06-23 13:58:31 +09:30

14 lines
318 B
Makefile

cln-grpc-wrongdir:
$(MAKE) -C .. cln-grpc-all
CLN_GRPC_EXAMPLES :=
CLN_GRPC_GENALL = cln-grpc/proto/node.proto \
cln-grpc/src/convert.rs \
cln-grpc/src/server.rs
DEFAULT_TARGETS += $(CLN_GRPC_EXAMPLES) $(CLN_GRPC_GENALL)
MSGGEN_GENALL += $(CLN_GRPC_GENALL)
cln-grpc-all: ${CLN_GRPC_GENALL} ${CLN_GRPC_EXAMPLES}