18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# scripts/dtc makefile
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_DTC)		+= dtc
58c2ecf20Sopenharmony_cihostprogs-always-$(CHECK_DT_BINDING)	+= dtc
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cidtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
88c2ecf20Sopenharmony_ci		   srcpos.o checks.o util.o
98c2ecf20Sopenharmony_cidtc-objs	+= dtc-lexer.lex.o dtc-parser.tab.o
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci# Source files need to get at the userspace version of libfdt_env.h to compile
128c2ecf20Sopenharmony_ciHOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
158c2ecf20Sopenharmony_ciifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
168c2ecf20Sopenharmony_ci$(error dtc needs libyaml for DT schema validation support. \
178c2ecf20Sopenharmony_ci	Install the necessary libyaml development package.)
188c2ecf20Sopenharmony_ciendif
198c2ecf20Sopenharmony_ciHOST_EXTRACFLAGS += -DNO_YAML
208c2ecf20Sopenharmony_cielse
218c2ecf20Sopenharmony_cidtc-objs	+= yamltree.o
228c2ecf20Sopenharmony_ci# To include <yaml.h> installed in a non-default path
238c2ecf20Sopenharmony_ciHOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
248c2ecf20Sopenharmony_ci# To link libyaml installed in a non-default path
258c2ecf20Sopenharmony_ciHOSTLDLIBS_dtc	:= $(shell pkg-config --libs yaml-0.1)
268c2ecf20Sopenharmony_ciendif
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci# Generated files need one more search path to include headers in source tree
298c2ecf20Sopenharmony_ciHOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
308c2ecf20Sopenharmony_ciHOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci# dependencies on generated files need to be listed explicitly
338c2ecf20Sopenharmony_ci$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
34