dt-bindings: kbuild: Add separate target/dependency for processed-schema.json
authorRob Herring <robh@kernel.org>
Fri, 5 Apr 2024 22:56:03 +0000 (17:56 -0500)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 2 May 2024 10:48:00 +0000 (19:48 +0900)
Running dtbs_check and dt_compatible_check targets really only depend
on processed-schema.json, but the dependency is 'dt_binding_check'. That
was sort worked around with the CHECK_DT_BINDING variable in order to
skip some of the work that 'dt_binding_check' does. It still runs the
full checks of the schemas which is not necessary and adds 10s of
seconds to the build time. That's significant when checking only a few
DTBs and with recent changes that have improved the validation time by
6-7x.

Add a new target, dt_binding_schema, which just builds
processed-schema.json and can be used as the dependency for other
targets. The scripts_dtc dependency isn't needed either as the examples
aren't built for it.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Documentation/devicetree/bindings/Makefile
Makefile
scripts/Makefile.lib

index 3779405269ab9ba61c91ca05b940afd140952d2a..8cdda477987fd66490c29b377b53610d99266e8c 100644 (file)
@@ -63,7 +63,7 @@ override DTC_FLAGS := \
 $(obj)/processed-schema.json: $(DT_DOCS) check_dtschema_version FORCE
        $(call if_changed,mk_schema)
 
-always-$(CHECK_DT_BINDING) += .dt-binding.checked .yamllint.checked
+targets += .dt-binding.checked .yamllint.checked
 $(obj)/.yamllint.checked: $(DT_DOCS) $(src)/.yamllint FORCE
        $(if $(DT_SCHEMA_LINT),$(call if_changed,yamllint),)
 
@@ -71,8 +71,8 @@ $(obj)/.dt-binding.checked: $(DT_DOCS) FORCE
        $(call if_changed,chk_bindings)
 
 always-y += processed-schema.json
-always-$(CHECK_DT_BINDING) += $(patsubst $(obj)/%,%, $(CHK_DT_EXAMPLES))
-always-$(CHECK_DT_BINDING) += $(patsubst $(obj)/%.dtb,%.dts, $(CHK_DT_EXAMPLES))
+targets += $(patsubst $(obj)/%,%, $(CHK_DT_EXAMPLES))
+targets += $(patsubst $(obj)/%.dtb,%.dts, $(CHK_DT_EXAMPLES))
 
 # Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
 # build artifacts here before they are processed by scripts/Makefile.clean
@@ -81,3 +81,6 @@ clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \
 
 dt_compatible_check: $(obj)/processed-schema.json
        $(Q)$(srctree)/scripts/dtc/dt-extract-compatibles $(srctree) | xargs dt-check-compatible -v -s $<
+
+PHONY += dt_binding_check
+dt_binding_check: $(obj)/.dt-binding.checked $(obj)/.yamllint.checked $(CHK_DT_EXAMPLES)
index 43b10f3d438cf4f3b8b099340f7cc2c1396ee178..026971f9f6bcc8daedada437ba9b4ac886328ed5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1403,7 +1403,7 @@ export CHECK_DTBS=y
 endif
 
 ifneq ($(CHECK_DTBS),)
-dtbs_prepare: dt_binding_check
+dtbs_prepare: dt_binding_schemas
 endif
 
 dtbs_check: dtbs
@@ -1422,15 +1422,18 @@ scripts_dtc: scripts_basic
        $(Q)$(MAKE) $(build)=scripts/dtc
 
 ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
-export CHECK_DT_BINDING=y
+export CHECK_DTBS=y
 endif
 
-PHONY += dt_binding_check
-dt_binding_check: scripts_dtc
+PHONY += dt_binding_check dt_binding_schemas
+dt_binding_check: dt_binding_schemas scripts_dtc
+       $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings $@
+
+dt_binding_schemas:
        $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
 
 PHONY += dt_compatible_check
-dt_compatible_check: dt_binding_check
+dt_compatible_check: dt_binding_schemas
        $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings $@
 
 # ---------------------------------------------------------------------------
@@ -1626,10 +1629,11 @@ help:
        @echo  ''
        @$(if $(dtstree), \
                echo 'Devicetree:'; \
-               echo '* dtbs             - Build device tree blobs for enabled boards'; \
-               echo '  dtbs_install     - Install dtbs to $(INSTALL_DTBS_PATH)'; \
-               echo '  dt_binding_check - Validate device tree binding documents'; \
-               echo '  dtbs_check       - Validate device tree source files';\
+               echo '* dtbs               - Build device tree blobs for enabled boards'; \
+               echo '  dtbs_install       - Install dtbs to $(INSTALL_DTBS_PATH)'; \
+               echo '  dt_binding_check   - Validate device tree binding documents and examples'; \
+               echo '  dt_binding_schema  - Build processed device tree binding schemas'; \
+               echo '  dtbs_check         - Validate device tree source files';\
                echo '')
 
        @echo 'Userspace tools targets:'
index 3179747cbd2cc014d0a8ba98cff008f28fbbc050..d1d51e38b55d7ab3e22a4e1630f7cbdaac042d20 100644 (file)
@@ -410,7 +410,7 @@ $(multi-dtb-y): FORCE
        $(call if_changed,fdtoverlay)
 $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
 
-ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
+ifneq ($(CHECK_DTBS),)
 DT_CHECKER ?= dt-validate
 DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
 DT_BINDING_DIR := Documentation/devicetree/bindings