blob: 95aaf7431bffab05da5ee186ef3b6461dba21fd1 [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 Herringc3476d22021-02-23 15:12:52 -06004# *** Also keep .gitignore in sync when changing ***
Viresh Kumar0da6bcd2021-01-29 12:54:06 +05305hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay
Masahiro Yamadafaabed22020-08-01 21:27:18 +09006hostprogs-always-$(CHECK_DT_BINDING) += dtc
David Gibson9fffb552009-04-30 15:25:53 +10007
8dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
John Bonesio658f29a2010-11-17 15:28:20 -08009 srcpos.o checks.o util.o
David Gibson9fffb552009-04-30 15:25:53 +100010dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
11
Viresh Kumar0da6bcd2021-01-29 12:54:06 +053012# The upstream project builds libfdt as a separate library. We are choosing to
13# instead directly link the libfdt object files into fdtoverlay.
14libfdt-objs := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
15libfdt = $(addprefix libfdt/,$(libfdt-objs))
16fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o
17
David Gibson9fffb552009-04-30 15:25:53 +100018# Source files need to get at the userspace version of libfdt_env.h to compile
Uwe Kleine-Königefe84d42020-09-19 16:39:22 +020019HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
David Gibson9fffb552009-04-30 15:25:53 +100020
Pavel Modilaynen067c6502019-07-12 13:52:19 +020021ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
Masahiro Yamada09030602020-04-17 13:04:55 +090022ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
Rob Herring4f0e3a52018-09-06 13:26:07 -050023$(error dtc needs libyaml for DT schema validation support. \
24 Install the necessary libyaml development package.)
25endif
Rob Herringf8589272018-09-13 08:59:25 -050026HOST_EXTRACFLAGS += -DNO_YAML
27else
28dtc-objs += yamltree.o
Masahiro Yamadaf8d8b462020-05-05 19:03:19 +090029# To include <yaml.h> installed in a non-default path
30HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
31# To link libyaml installed in a non-default path
Pavel Modilaynen067c6502019-07-12 13:52:19 +020032HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
Rob Herringf8589272018-09-13 08:59:25 -050033endif
34
Masahiro Yamadae3fd9b52018-07-04 10:59:23 +090035# Generated files need one more search path to include headers in source tree
Masahiro Yamada9cc342f2019-05-13 15:22:16 +090036HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
37HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
David Gibson9fffb552009-04-30 15:25:53 +100038
39# dependencies on generated files need to be listed explicitly
Arnaud Lacombe95abef82011-05-23 03:17:20 -040040$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h