On Wed, Nov 30, 2022 at 12:15:08PM +0000, Bertrand Marquis wrote:
> --- a/automation/build/Makefile
> +++ b/automation/build/Makefile
> @@ -28,3 +28,13 @@ all: $(CONTAINERS)
> clean:
> rm -f yocto/*.dockerfiles
>
> +define CLEAN_RULE
> +.PHONY: clean-$(1)
> +clean-$(1):
> +ifneq ($$(shell docker image ls -q $(REGISTRY)/$(subst /,:,$(1))),)
Please, don't use "ifneq" in a rule's recipe, especially when running a
shell command. That shell command is evaluated every time make parse the
makefile, so we are going to run `docker image ls` 23 times!
Just write the call to `docker image ls` and evaluate the result in
shell. I guess something like:
[ "$(docker image ls -q ...)" ] && docker image rm ...
Cheers,
--
Anthony PERARD