14f0e3a57SRob Herring# SPDX-License-Identifier: GPL-2.0
24f0e3a57SRob HerringDT_DOC_CHECKER ?= dt-doc-validate
34f0e3a57SRob HerringDT_EXTRACT_EX ?= dt-extract-example
44f0e3a57SRob HerringDT_MK_SCHEMA ?= dt-mk-schema
54f0e3a57SRob HerringDT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u)
64f0e3a57SRob Herring
74f0e3a57SRob Herringquiet_cmd_chk_binding = CHKDT   $(patsubst $(srctree)/%,%,$<)
84f0e3a57SRob Herring      cmd_chk_binding = $(DT_DOC_CHECKER) $< ; \
94f0e3a57SRob Herring                        $(DT_EXTRACT_EX) $< > $@
104f0e3a57SRob Herring
114f0e3a57SRob Herring$(obj)/%.example.dts: $(src)/%.yaml FORCE
124f0e3a57SRob Herring	$(call if_changed,chk_binding)
134f0e3a57SRob Herring
144f0e3a57SRob HerringDT_TMP_SCHEMA := processed-schema.yaml
154f0e3a57SRob Herringextra-y += $(DT_TMP_SCHEMA)
164f0e3a57SRob Herring
174f0e3a57SRob Herringquiet_cmd_mk_schema = SCHEMA  $@
18afa974b7SMasahiro Yamada      cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
194f0e3a57SRob Herring
204f0e3a57SRob HerringDT_DOCS = $(shell cd $(srctree)/$(src) && find * -name '*.yaml')
214f0e3a57SRob HerringDT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS))
224f0e3a57SRob Herring
234f0e3a57SRob Herringextra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
244f0e3a57SRob Herringextra-y += $(patsubst $(src)/%.yaml,%.example.dtb, $(DT_SCHEMA_FILES))
254f0e3a57SRob Herring
264f0e3a57SRob Herring$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE
274f0e3a57SRob Herring	$(call if_changed,mk_schema)
28