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_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u) 6 7quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) 8 cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ 9 $(DT_EXTRACT_EX) $< > $@ 10 11$(obj)/%.example.dts: $(src)/%.yaml FORCE 12 $(call if_changed,chk_binding) 13 14# Use full schemas when checking %.example.dts 15DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml 16 17find_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \ 18 -name 'processed-schema*' ! \ 19 -name '*.example.dt.yaml' \) 20 21quiet_cmd_mk_schema = SCHEMA $@ 22 cmd_mk_schema = rm -f $@ ; \ 23 $(if $(DT_MK_SCHEMA_FLAGS), \ 24 echo $(real-prereqs), \ 25 $(find_cmd)) | \ 26 xargs $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) >> $@ 27 28DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||') 29 30DT_SCHEMA_FILES ?= $(DT_DOCS) 31 32extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) 33extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) 34extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml 35 36override DTC_FLAGS := \ 37 -Wno-avoid_unnecessary_addr_size \ 38 -Wno-graph_child_address 39 40$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE 41 $(call if_changed,mk_schema) 42 43$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := $(DT_MK_SCHEMA_USERONLY_FLAG) 44$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE 45 $(call if_changed,mk_schema) 46 47extra-y += processed-schema.yaml 48