blob: b5a5b1c548c9b230316101d1fc958d16de5913dc [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
David Gibson9fffb552009-04-30 15:25:53 +10002# scripts/dtc makefile
3
Rob Herring37c8a5f2018-01-10 15:19:37 -06004hostprogs-$(CONFIG_DTC) := dtc
David Gibson9fffb552009-04-30 15:25:53 +10005always := $(hostprogs-y)
6
7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
John Bonesio658f29a2010-11-17 15:28:20 -08008 srcpos.o checks.o util.o
David Gibson9fffb552009-04-30 15:25:53 +10009dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
10
11# Source files need to get at the userspace version of libfdt_env.h to compile
Masahiro Yamada9cc342f2019-05-13 15:22:16 +090012HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
David Gibson9fffb552009-04-30 15:25:53 +100013
Pavel Modilaynen067c6502019-07-12 13:52:19 +020014ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
Rob Herring4f0e3a52018-09-06 13:26:07 -050015ifneq ($(CHECK_DTBS),)
16$(error dtc needs libyaml for DT schema validation support. \
17 Install the necessary libyaml development package.)
18endif
Rob Herringf8589272018-09-13 08:59:25 -050019HOST_EXTRACFLAGS += -DNO_YAML
20else
21dtc-objs += yamltree.o
Pavel Modilaynen067c6502019-07-12 13:52:19 +020022HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
Rob Herringf8589272018-09-13 08:59:25 -050023endif
24
Masahiro Yamadae3fd9b52018-07-04 10:59:23 +090025# Generated files need one more search path to include headers in source tree
Masahiro Yamada9cc342f2019-05-13 15:22:16 +090026HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
27HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
David Gibson9fffb552009-04-30 15:25:53 +100028
29# dependencies on generated files need to be listed explicitly
Arnaud Lacombe95abef82011-05-23 03:17:20 -040030$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h