* [PATCH] kbuild: determine the output format of DTC by the target suffix
@ 2020-04-27 14:12 Masahiro Yamada
2020-05-01 5:37 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2020-04-27 14:12 UTC (permalink / raw)
To: linux-kbuild
Cc: Rob Herring, devicetree, Masahiro Yamada, Michal Marek, linux-kernel
cmd_dtc takes the additional parameter $(2) to select the target
format, dtb or yaml. This makes things complicated when it is used
with cmd_and_fixdep and if_changed_rule. I actually stumbled on this.
See commit 3d4b2238684a ("kbuild: fix DT binding schema rule again to
avoid needless rebuilds").
Extract the suffix part of the target instead of passing the parameter.
Fortunately, this works for both $(obj)/%.dtb and $(obj)/%.dt.yaml .
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/Makefile.lib | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 12f6a331a8f3..cd52a8c6428f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -287,13 +287,13 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
quiet_cmd_dtc = DTC $@
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(DTC) -O $(2) -o $@ -b 0 \
+ $(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
- $(call if_changed_dep,dtc,dtb)
+ $(call if_changed_dep,dtc)
DT_CHECKER ?= dt-validate
DT_BINDING_DIR := Documentation/devicetree/bindings
@@ -304,7 +304,7 @@ quiet_cmd_dtb_check = CHECK $@
cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
define rule_dtc
- $(call cmd_and_fixdep,dtc,yaml)
+ $(call cmd_and_fixdep,dtc)
$(call cmd,dtb_check)
endef
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kbuild: determine the output format of DTC by the target suffix
2020-04-27 14:12 [PATCH] kbuild: determine the output format of DTC by the target suffix Masahiro Yamada
@ 2020-05-01 5:37 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2020-05-01 5:37 UTC (permalink / raw)
To: Linux Kbuild mailing list
Cc: Rob Herring, DTML, Michal Marek, Linux Kernel Mailing List
On Mon, Apr 27, 2020 at 11:13 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> cmd_dtc takes the additional parameter $(2) to select the target
> format, dtb or yaml. This makes things complicated when it is used
> with cmd_and_fixdep and if_changed_rule. I actually stumbled on this.
> See commit 3d4b2238684a ("kbuild: fix DT binding schema rule again to
> avoid needless rebuilds").
>
> Extract the suffix part of the target instead of passing the parameter.
> Fortunately, this works for both $(obj)/%.dtb and $(obj)/%.dt.yaml .
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Applied to linux-kbuild.
> ---
>
> scripts/Makefile.lib | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 12f6a331a8f3..cd52a8c6428f 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -287,13 +287,13 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
> quiet_cmd_dtc = DTC $@
> cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
> $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
> - $(DTC) -O $(2) -o $@ -b 0 \
> + $(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
> $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
> -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
>
> $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
> - $(call if_changed_dep,dtc,dtb)
> + $(call if_changed_dep,dtc)
>
> DT_CHECKER ?= dt-validate
> DT_BINDING_DIR := Documentation/devicetree/bindings
> @@ -304,7 +304,7 @@ quiet_cmd_dtb_check = CHECK $@
> cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
>
> define rule_dtc
> - $(call cmd_and_fixdep,dtc,yaml)
> + $(call cmd_and_fixdep,dtc)
> $(call cmd,dtb_check)
> endef
>
> --
> 2.25.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-01 5:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 14:12 [PATCH] kbuild: determine the output format of DTC by the target suffix Masahiro Yamada
2020-05-01 5:37 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).