1 # SPDX-License-Identifier: GPL-2.0 1 # SPDX-License-Identifier: GPL-2.0 2 DT_DOC_CHECKER ?= dt-doc-validate 2 DT_DOC_CHECKER ?= dt-doc-validate 3 DT_EXTRACT_EX ?= dt-extract-example 3 DT_EXTRACT_EX ?= dt-extract-example 4 DT_MK_SCHEMA ?= dt-mk-schema 4 DT_MK_SCHEMA ?= dt-mk-schema >> 5 DT_MK_SCHEMA_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u) 5 6 6 DT_SCHEMA_LINT = $(shell which yamllint || \ !! 7 quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) 7 echo "warning: python package 'yamllint' not !! 8 cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ >> 9 $(DT_EXTRACT_EX) $< > $@ 8 10 9 DT_SCHEMA_MIN_VERSION = 2023.9 !! 11 $(obj)/%.example.dts: $(src)/%.yaml FORCE >> 12 $(call if_changed,chk_binding) 10 13 11 PHONY += check_dtschema_version !! 14 # Use full schemas when checking %.example.dts 12 check_dtschema_version: !! 15 DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml 13 @which $(DT_DOC_CHECKER) >/dev/null || << 14 { echo "Error: '$(DT_DOC_CHECK << 15 echo "Ensure dtschema python << 16 echo "Current PATH is:" >&2; << 17 echo "$$PATH" >&2; false; } << 18 @{ echo $(DT_SCHEMA_MIN_VERSION); \ << 19 $(DT_DOC_CHECKER) --version 2>/dev/nul << 20 { echo "ERROR: dtschema minimum versio << 21 << 22 quiet_cmd_extract_ex = DTEX $@ << 23 cmd_extract_ex = $(DT_EXTRACT_EX) $< > $ << 24 << 25 $(obj)/%.example.dts: $(src)/%.yaml check_dtsc << 26 $(call if_changed,extract_ex) << 27 << 28 find_all_cmd = find $(src) \( -name '*.yaml' ! << 29 -name 'processed-schema*' \) << 30 << 31 find_cmd = $(find_all_cmd) | \ << 32 sed 's|^$(srctree)/||' | \ << 33 grep -F -e "$(subst :," -e ",$ << 34 sed 's|^|$(srctree)/|' << 35 CHK_DT_EXAMPLES := $(patsubst $(srctree)/%.yam << 36 << 37 quiet_cmd_yamllint = LINT $(src) << 38 cmd_yamllint = ($(find_cmd) | \ << 39 xargs -n200 -P$$(nproc) \ << 40 $(DT_SCHEMA_LINT) -f pars << 41 && touch $@ || true << 42 << 43 quiet_cmd_chk_bindings = CHKDT $(src) << 44 cmd_chk_bindings = ($(find_cmd) | \ << 45 xargs -n200 -P$$(npr << 46 && touch $@ || true << 47 16 48 quiet_cmd_mk_schema = SCHEMA $@ !! 17 find_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \ 49 cmd_mk_schema = f=$$(mktemp) ; \ !! 18 -name 'processed-schema*' ! \ 50 $(find_all_cmd) > $$f ; !! 19 -name '*.example.dt.yaml' \) 51 $(DT_MK_SCHEMA) -j $(DT_ << 52 rm -f $$f << 53 20 54 DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $( !! 21 quiet_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 >> 28 DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||') >> 29 >> 30 DT_SCHEMA_FILES ?= $(DT_DOCS) >> 31 >> 32 extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) >> 33 extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES)) >> 34 extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml 55 35 56 override DTC_FLAGS := \ 36 override DTC_FLAGS := \ 57 -Wno-avoid_unnecessary_addr_size \ 37 -Wno-avoid_unnecessary_addr_size \ 58 -Wno-graph_child_address \ !! 38 -Wno-graph_child_address 59 -Wno-interrupt_provider \ !! 39 60 -Wno-unique_unit_address \ !! 40 $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE 61 -Wunique_unit_address_if_enabled !! 41 $(call if_changed,mk_schema) 62 42 63 $(obj)/processed-schema.json: $(DT_DOCS) check !! 43 $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := $(DT_MK_SCHEMA_USERONLY_FLAG) >> 44 $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE 64 $(call if_changed,mk_schema) 45 $(call if_changed,mk_schema) 65 46 66 targets += .dt-binding.checked .yamllint.check !! 47 extra-y += processed-schema.yaml 67 $(obj)/.yamllint.checked: $(DT_DOCS) $(src)/.y << 68 $(if $(DT_SCHEMA_LINT),$(call if_chang << 69 << 70 $(obj)/.dt-binding.checked: $(DT_DOCS) FORCE << 71 $(call if_changed,chk_bindings) << 72 << 73 always-y += processed-schema.json << 74 targets += $(patsubst $(obj)/%,%, $(CHK_DT_EXA << 75 targets += $(patsubst $(obj)/%.dtb,%.dts, $(CH << 76 48 77 # Hack: avoid 'Argument list too long' error f 49 # Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of 78 # build artifacts here before they are process 50 # build artifacts here before they are processed by scripts/Makefile.clean 79 clean-files = $(shell find $(obj) \( -name '*. 51 clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \ 80 -name '*.example.dtb' !! 52 -name '*.example.dt.yaml' \) -delete 2>/dev/null) 81 << 82 dt_compatible_check: $(obj)/processed-schema.j << 83 $(Q)$(srctree)/scripts/dtc/dt-extract- << 84 << 85 PHONY += dt_binding_check << 86 dt_binding_check: $(obj)/.dt-binding.checked $ <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.