xref: /OK3568_Linux_fs/kernel/scripts/dtc/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun# scripts/dtc makefile
3*4882a593Smuzhiyun
4*4882a593Smuzhiyunhostprogs-always-$(CONFIG_DTC)		+= dtc
5*4882a593Smuzhiyunhostprogs-always-$(CHECK_DT_BINDING)	+= dtc
6*4882a593Smuzhiyun
7*4882a593Smuzhiyundtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
8*4882a593Smuzhiyun		   srcpos.o checks.o util.o
9*4882a593Smuzhiyundtc-objs	+= dtc-lexer.lex.o dtc-parser.tab.o
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun# Source files need to get at the userspace version of libfdt_env.h to compile
12*4882a593SmuzhiyunHOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
13*4882a593Smuzhiyun
14*4882a593Smuzhiyunifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
15*4882a593Smuzhiyunifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
16*4882a593Smuzhiyun$(error dtc needs libyaml for DT schema validation support. \
17*4882a593Smuzhiyun	Install the necessary libyaml development package.)
18*4882a593Smuzhiyunendif
19*4882a593SmuzhiyunHOST_EXTRACFLAGS += -DNO_YAML
20*4882a593Smuzhiyunelse
21*4882a593Smuzhiyundtc-objs	+= yamltree.o
22*4882a593Smuzhiyun# To include <yaml.h> installed in a non-default path
23*4882a593SmuzhiyunHOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
24*4882a593Smuzhiyun# To link libyaml installed in a non-default path
25*4882a593SmuzhiyunHOSTLDLIBS_dtc	:= $(shell pkg-config --libs yaml-0.1)
26*4882a593Smuzhiyunendif
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# Generated files need one more search path to include headers in source tree
29*4882a593SmuzhiyunHOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
30*4882a593SmuzhiyunHOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun# dependencies on generated files need to be listed explicitly
33*4882a593Smuzhiyun$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
34