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 5DT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u) 6 7quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) 8 cmd_chk_binding = $(DT_DOC_CHECKER) $< ; \ 9 $(DT_EXTRACT_EX) $< > $@ 10 11$(obj)/%.example.dts: $(src)/%.yaml FORCE 12 $(call if_changed,chk_binding) 13 14DT_TMP_SCHEMA := processed-schema.yaml 15extra-y += $(DT_TMP_SCHEMA) 16 17quiet_cmd_mk_schema = SCHEMA $@ 18 cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) 19 20DT_DOCS = $(shell \ 21 cd $(srctree)/$(src) && \ 22 find * \( -name '*.yaml' ! -name $(DT_TMP_SCHEMA) \) \ 23 ) 24 25DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) 26 27extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) 28extra-y += $(patsubst $(src)/%.yaml,%.example.dtb, $(DT_SCHEMA_FILES)) 29 30$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE 31 $(call if_changed,mk_schema) 32