summaryrefslogtreecommitdiff
path: root/scripts/dtc
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-05-05 19:03:19 +0900
committerRob Herring <robh@kernel.org>2020-06-08 13:14:00 -0600
commitf8d8b46cd20e3a262c17ba1061640d9c190ad769 (patch)
tree1298c3e8472ab01c2dc52cbec0c29f895b1cc1c3 /scripts/dtc
parent8211d1e83aded34631aa87fa37f97d7bb712e925 (diff)
downloadlwn-f8d8b46cd20e3a262c17ba1061640d9c190ad769.tar.gz
lwn-f8d8b46cd20e3a262c17ba1061640d9c190ad769.zip
scripts/dtc: use pkg-config to include <yaml.h> in non-standard path
Commit 067c650c456e ("dtc: Use pkg-config to locate libyaml") added 'pkg-config --libs' to link libyaml installed in a non-standard location. yamltree.c includes <yaml.h>, but that commit did not add the search path for <yaml.h>. If /usr/include/yaml.h does not exist, it fails to build. A user can explicitly pass HOSTCFLAGS to work around it, but the policy is not consistent. There are two ways to deal with libraries in a non-default location. [1] Use HOSTCFLAGS and HOSTLDFLAGS for additional search paths for headers and libraries. They are documented in Documentation/kbuild/kbuild.rst $ make HOSTCFLAGS='-I <prefix>/include' HOSTLDFLAGS='-L <prefix>/lib' [2] Use pkg-config 'pkg-config --cflags' for querying the header search path 'pkg-config --libs' for querying the lib and its path If we go with pkg-config, use [2] consistently. Do not mix up [1] and [2]. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'scripts/dtc')
-rw-r--r--scripts/dtc/Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index ef85f8b7d4a7..0b44917f981c 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -20,6 +20,9 @@ endif
HOST_EXTRACFLAGS += -DNO_YAML
else
dtc-objs += yamltree.o
+# To include <yaml.h> installed in a non-default path
+HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
+# To link libyaml installed in a non-default path
HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
endif