blob: 5138a2f6232aa23cdc98211d2e3fcaaa2890030e [file] [log] [blame]
Rob Herring4f0e3a52018-09-06 13:26:07 -05001# 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)/%,%,$<)
Rob Herring05aeca72019-05-09 08:53:44 -05008 cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
Rob Herring4f0e3a52018-09-06 13:26:07 -05009 $(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 $@
Masahiro Yamadaafa974b2019-01-17 19:02:43 +090018 cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
Rob Herring4f0e3a52018-09-06 13:26:07 -050019
Rob Herring5fa98c22019-01-22 09:10:10 -060020DT_DOCS = $(shell \
21 cd $(srctree)/$(src) && \
Rob Herring740ce362019-07-30 08:49:34 -060022 find * \( -name '*.yaml' ! \
23 -name $(DT_TMP_SCHEMA) ! \
24 -name '*.example.dt.yaml' \) \
Rob Herring5fa98c22019-01-22 09:10:10 -060025 )
26
Rob Herring4f0e3a52018-09-06 13:26:07 -050027DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS))
28
29extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
Rob Herring837158b2019-05-17 16:17:08 -050030extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
Rob Herring4f0e3a52018-09-06 13:26:07 -050031
32$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE
33 $(call if_changed,mk_schema)