Rob Herring | 4f0e3a5 | 2018-09-06 13:26:07 -0500 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | DT_DOC_CHECKER ?= dt-doc-validate |
| 3 | DT_EXTRACT_EX ?= dt-extract-example |
| 4 | DT_MK_SCHEMA ?= dt-mk-schema |
| 5 | DT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u) |
| 6 | |
| 7 | quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) |
Rob Herring | 05aeca7 | 2019-05-09 08:53:44 -0500 | [diff] [blame] | 8 | cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ |
Rob Herring | 4f0e3a5 | 2018-09-06 13:26:07 -0500 | [diff] [blame] | 9 | $(DT_EXTRACT_EX) $< > $@ |
| 10 | |
| 11 | $(obj)/%.example.dts: $(src)/%.yaml FORCE |
| 12 | $(call if_changed,chk_binding) |
| 13 | |
| 14 | DT_TMP_SCHEMA := processed-schema.yaml |
| 15 | extra-y += $(DT_TMP_SCHEMA) |
| 16 | |
| 17 | quiet_cmd_mk_schema = SCHEMA $@ |
Masahiro Yamada | afa974b | 2019-01-17 19:02:43 +0900 | [diff] [blame] | 18 | cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) |
Rob Herring | 4f0e3a5 | 2018-09-06 13:26:07 -0500 | [diff] [blame] | 19 | |
Rob Herring | 5fa98c2 | 2019-01-22 09:10:10 -0600 | [diff] [blame] | 20 | DT_DOCS = $(shell \ |
| 21 | cd $(srctree)/$(src) && \ |
Rob Herring | 740ce36 | 2019-07-30 08:49:34 -0600 | [diff] [blame] | 22 | find * \( -name '*.yaml' ! \ |
| 23 | -name $(DT_TMP_SCHEMA) ! \ |
| 24 | -name '*.example.dt.yaml' \) \ |
Rob Herring | 5fa98c2 | 2019-01-22 09:10:10 -0600 | [diff] [blame] | 25 | ) |
| 26 | |
Rob Herring | 4f0e3a5 | 2018-09-06 13:26:07 -0500 | [diff] [blame] | 27 | DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) |
| 28 | |
| 29 | extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) |
Rob Herring | 837158b | 2019-05-17 16:17:08 -0500 | [diff] [blame] | 30 | extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) |
Rob Herring | 4f0e3a5 | 2018-09-06 13:26:07 -0500 | [diff] [blame] | 31 | |
| 32 | $(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE |
| 33 | $(call if_changed,mk_schema) |