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

Richard Marko srk at 48.io
Tue Oct 17 12:44:53 CEST 2023


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 )

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)
-- 
2.42.0



More information about the U-Boot mailing list