blob: f1d201782346fa84f616b7b15824fc2273e98479 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001# SPDX-License-Identifier: GPL-2.0
2# scripts/dtc makefile
3
Olivier Deprez157378f2022-04-04 15:47:50 +02004hostprogs-always-$(CONFIG_DTC) += dtc
5hostprogs-always-$(CHECK_DT_BINDING) += dtc
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006
7dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
8 srcpos.o checks.o util.o
9dtc-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
Olivier Deprez0e641232021-09-23 10:07:05 +020012HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
David Brazdil0f672f62019-12-10 10:32:29 +000013
Olivier Deprez0e641232021-09-23 10:07:05 +020014ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
Olivier Deprez157378f2022-04-04 15:47:50 +020015ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
David Brazdil0f672f62019-12-10 10:32:29 +000016$(error dtc needs libyaml for DT schema validation support. \
17 Install the necessary libyaml development package.)
18endif
19HOST_EXTRACFLAGS += -DNO_YAML
20else
21dtc-objs += yamltree.o
Olivier Deprez157378f2022-04-04 15:47:50 +020022# To include <yaml.h> installed in a non-default path
23HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
24# To link libyaml installed in a non-default path
Olivier Deprez92d4c212022-12-06 15:05:30 +010025HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1)
David Brazdil0f672f62019-12-10 10:32:29 +000026endif
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000027
28# Generated files need one more search path to include headers in source tree
David Brazdil0f672f62019-12-10 10:32:29 +000029HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
30HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000031
32# dependencies on generated files need to be listed explicitly
33$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h