Skip to content

Commit 604a57b

Browse files
robherringmasahir0y
authored andcommitted
dt-bindings: kbuild: Add separate target/dependency for processed-schema.json
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 <[email protected]> Tested-by: Conor Dooley <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 6552b72 commit 604a57b

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

Documentation/devicetree/bindings/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ override DTC_FLAGS := \
6363
$(obj)/processed-schema.json: $(DT_DOCS) check_dtschema_version FORCE
6464
$(call if_changed,mk_schema)
6565

66-
always-$(CHECK_DT_BINDING) += .dt-binding.checked .yamllint.checked
66+
targets += .dt-binding.checked .yamllint.checked
6767
$(obj)/.yamllint.checked: $(DT_DOCS) $(src)/.yamllint FORCE
6868
$(if $(DT_SCHEMA_LINT),$(call if_changed,yamllint),)
6969

7070
$(obj)/.dt-binding.checked: $(DT_DOCS) FORCE
7171
$(call if_changed,chk_bindings)
7272

7373
always-y += processed-schema.json
74-
always-$(CHECK_DT_BINDING) += $(patsubst $(obj)/%,%, $(CHK_DT_EXAMPLES))
75-
always-$(CHECK_DT_BINDING) += $(patsubst $(obj)/%.dtb,%.dts, $(CHK_DT_EXAMPLES))
74+
targets += $(patsubst $(obj)/%,%, $(CHK_DT_EXAMPLES))
75+
targets += $(patsubst $(obj)/%.dtb,%.dts, $(CHK_DT_EXAMPLES))
7676

7777
# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
7878
# build artifacts here before they are processed by scripts/Makefile.clean
@@ -81,3 +81,6 @@ clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \
8181

8282
dt_compatible_check: $(obj)/processed-schema.json
8383
$(Q)$(srctree)/scripts/dtc/dt-extract-compatibles $(srctree) | xargs dt-check-compatible -v -s $<
84+
85+
PHONY += dt_binding_check
86+
dt_binding_check: $(obj)/.dt-binding.checked $(obj)/.yamllint.checked $(CHK_DT_EXAMPLES)

Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ export CHECK_DTBS=y
14031403
endif
14041404

14051405
ifneq ($(CHECK_DTBS),)
1406-
dtbs_prepare: dt_binding_check
1406+
dtbs_prepare: dt_binding_schemas
14071407
endif
14081408

14091409
dtbs_check: dtbs
@@ -1422,15 +1422,18 @@ scripts_dtc: scripts_basic
14221422
$(Q)$(MAKE) $(build)=scripts/dtc
14231423

14241424
ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
1425-
export CHECK_DT_BINDING=y
1425+
export CHECK_DTBS=y
14261426
endif
14271427

1428-
PHONY += dt_binding_check
1429-
dt_binding_check: scripts_dtc
1428+
PHONY += dt_binding_check dt_binding_schemas
1429+
dt_binding_check: dt_binding_schemas scripts_dtc
1430+
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings $@
1431+
1432+
dt_binding_schemas:
14301433
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
14311434

14321435
PHONY += dt_compatible_check
1433-
dt_compatible_check: dt_binding_check
1436+
dt_compatible_check: dt_binding_schemas
14341437
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings $@
14351438

14361439
# ---------------------------------------------------------------------------
@@ -1626,10 +1629,11 @@ help:
16261629
@echo ''
16271630
@$(if $(dtstree), \
16281631
echo 'Devicetree:'; \
1629-
echo '* dtbs - Build device tree blobs for enabled boards'; \
1630-
echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'; \
1631-
echo ' dt_binding_check - Validate device tree binding documents'; \
1632-
echo ' dtbs_check - Validate device tree source files';\
1632+
echo '* dtbs - Build device tree blobs for enabled boards'; \
1633+
echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'; \
1634+
echo ' dt_binding_check - Validate device tree binding documents and examples'; \
1635+
echo ' dt_binding_schema - Build processed device tree binding schemas'; \
1636+
echo ' dtbs_check - Validate device tree source files';\
16331637
echo '')
16341638

16351639
@echo 'Userspace tools targets:'

scripts/Makefile.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ $(multi-dtb-y): FORCE
410410
$(call if_changed,fdtoverlay)
411411
$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
412412

413-
ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
413+
ifneq ($(CHECK_DTBS),)
414414
DT_CHECKER ?= dt-validate
415415
DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
416416
DT_BINDING_DIR := Documentation/devicetree/bindings

0 commit comments

Comments
 (0)