On Thu, Dec 04, 2025 at 04:37:11AM -0800, [email protected] wrote:
> diff --git a/tools/tests/domid/Makefile b/tools/tests/domid/Makefile
> index 753129029ed9..1a2129d20655 100644
> --- a/tools/tests/domid/Makefile
> +++ b/tools/tests/domid/Makefile
> @@ -14,16 +14,18 @@ $(shell sed -n \
>      's/^[ \t]*# *include[ \t]*[<"]\([^">]*\)[">].*/\1/p' $(1) 2>/dev/null)
>  endef
>  
> -# NB: $1 cannot be a list
> +# $1 target
> +# $2 list of test harnesses
>  define emit-harness-nested-rule
> -$(1): $(CURDIR)/harness.h
> -     mkdir -p $$(@D);
> -     ln -sf $$< $$@;
> +$(1): $(2)
> +     mkdir -p $$(@D); \
> +     for i in $$<; do ln -sf $$$$i $$@; done

This doesn't work.

First, on the first line, the introduction of the backslash mean that
error from `mkdir` are ignored, Make will execute both line in the same
shell instead of 2 separate shell. You would need to add `set -e` if
executing all lines of the recipe in the same shell is useful.

Second, $< only refer to the first prerequisite. So only a single
symlink is created, even if $(2) list multiple files.

Third, if we fix to loop through all the dependencies, the loop will
still only create a single symlink, the last iteration will overwrite
the previous one.

Thanks,

-- 
Anthony PERARD

Reply via email to