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 5e996c1fdSRob HerringDT_MK_SCHEMA_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u) 64f0e3a57SRob Herring 74f0e3a57SRob Herringquiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) 805aeca7cSRob Herring cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ 94f0e3a57SRob Herring $(DT_EXTRACT_EX) $< > $@ 104f0e3a57SRob Herring 114f0e3a57SRob Herring$(obj)/%.example.dts: $(src)/%.yaml FORCE 124f0e3a57SRob Herring $(call if_changed,chk_binding) 134f0e3a57SRob Herring 142ba06cd8SRob Herring# Use full schemas when checking %.example.dts 152ba06cd8SRob HerringDT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml 164f0e3a57SRob Herring 178b6b8021SRob Herringfind_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \ 182ba06cd8SRob Herring -name 'processed-schema*' ! \ 198b6b8021SRob Herring -name '*.example.dt.yaml' \) 208b6b8021SRob Herring 218b6b8021SRob Herringquiet_cmd_mk_schema = SCHEMA $@ 228b6b8021SRob Herring cmd_mk_schema = rm -f $@ ; \ 238b6b8021SRob Herring $(if $(DT_MK_SCHEMA_FLAGS), \ 248b6b8021SRob Herring echo $(real-prereqs), \ 258b6b8021SRob Herring $(find_cmd)) | \ 268b6b8021SRob Herring xargs $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) >> $@ 278b6b8021SRob Herring 288b6b8021SRob HerringDT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||') 295fa98c2eSRob Herring 302ba06cd8SRob HerringDT_SCHEMA_FILES ?= $(DT_DOCS) 314f0e3a57SRob Herring 32e10c4321SMasahiro Yamadaextra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) 33e10c4321SMasahiro Yamadaextra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) 34e10c4321SMasahiro Yamadaextra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml 352ba06cd8SRob Herring 3665220630SRob Herringoverride DTC_FLAGS := \ 3765220630SRob Herring -Wno-avoid_unnecessary_addr_size \ 3865220630SRob Herring -Wno-graph_child_address 3965220630SRob Herring 402ba06cd8SRob Herring$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE 412ba06cd8SRob Herring $(call if_changed,mk_schema) 424f0e3a57SRob Herring 43e996c1fdSRob Herring$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := $(DT_MK_SCHEMA_USERONLY_FLAG) 442ba06cd8SRob Herring$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE 454f0e3a57SRob Herring $(call if_changed,mk_schema) 4693512dadSRob Herring 472ba06cd8SRob Herringextra-y += processed-schema.yaml 48