Skip to content

Commit f8d8b46

Browse files
masahir0yrobherring
authored andcommitted
scripts/dtc: use pkg-config to include <yaml.h> in non-standard path
Commit 067c650 ("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 <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 8211d1e commit f8d8b46

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/dtc/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ endif
2020
HOST_EXTRACFLAGS += -DNO_YAML
2121
else
2222
dtc-objs += yamltree.o
23+
# To include <yaml.h> installed in a non-default path
24+
HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1)
25+
# To link libyaml installed in a non-default path
2326
HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
2427
endif
2528

0 commit comments

Comments
 (0)