1# SPDX-License-Identifier: GPL-2.0 2DT_DOC_CHECKER ?= dt-doc-validate 3DT_EXTRACT_EX ?= dt-extract-example 4DT_MK_SCHEMA ?= dt-mk-schema 5 6quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) 7 cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ 8 $(DT_EXTRACT_EX) $< > $@ 9 10$(obj)/%.example.dts: $(src)/%.yaml FORCE 11 $(call if_changed,chk_binding) 12 13# Use full schemas when checking %.example.dts 14DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml 15 16quiet_cmd_mk_schema = SCHEMA $@ 17 cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) 18 19DT_DOCS = $(addprefix $(src)/, \ 20 $(shell \ 21 cd $(srctree)/$(src) && \ 22 find * \( -name '*.yaml' ! \ 23 -name 'processed-schema*' ! \ 24 -name '*.example.dt.yaml' \) \ 25 )) 26 27DT_SCHEMA_FILES ?= $(DT_DOCS) 28 29extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) 30extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) 31extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml 32 33override DTC_FLAGS := \ 34 -Wno-avoid_unnecessary_addr_size \ 35 -Wno-graph_child_address 36 37$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE 38 $(call if_changed,mk_schema) 39 40$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u 41$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE 42 $(call if_changed,mk_schema) 43 44extra-y += processed-schema.yaml 45