[PATCH] kbuild: use which $(DTC) as a dependency

Robert Marko robimarko at gmail.com
Tue Oct 17 15:17:29 CEST 2023


On 17. 10. 2023. 12:44, Richard Marko wrote:
> If we try to build using external dtc using
>
>> make DTC=dtc
> we get a confusing error like
>
>> make[2]: *** No rule to make target 'arch/x86/dts/bayleybay.dtb',
>> needed by 'dtbs'.  Stop.
> Workaround is to use
>
>> make DTC=$( which dtc )
Can you please use command -v dtc instead as which is not part of POSIX?

Regards,
Robert
> which gives make a full path, so the dependency
> is satisfied.
>
> This was introduced by commit
> d50af66 kbuild: add dtc as dependency on .dtb files
>
> and we extend it so it calls which automatically
> (similar to scripts/dtc-version.sh)
>
> Signed-off-by: Richard Marko <srk at 48.io>
> ---
>   scripts/Makefile.lib | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 8dc6ec82cd..04fc9b0752 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -351,7 +351,7 @@ endif
>   
>   dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
>   
> -$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
> +$(obj)/%.dtb: $(src)/%.dts $(shell which $(DTC)) $(dtsi_include_list_deps) FORCE
>   	$(call if_changed_dep,dtc)
>   
>   pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)


More information about the U-Boot mailing list