summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/gpio
diff options
context:
space:
mode:
authorDaniel Díaz <daniel.diaz@linaro.org>2018-10-17 00:46:59 +0300
committerShuah Khan <shuah@kernel.org>2018-11-28 00:20:36 +0300
commit694f1f926c725a8955c1c156ad6d3c4e1b853bd8 (patch)
tree68de5244b599d994c8126f89bd335675ff879b93 /tools/testing/selftests/gpio
parent7492902e8d22b568463897fa967c0886764cf034 (diff)
downloadlinux-694f1f926c725a8955c1c156ad6d3c4e1b853bd8.tar.xz
selftests: gpio: Find libmount with pkg-config if available
If pkg-config is available, use it to define the CFLAGS and LDLIBS needed for libmount; else, use the current hard-coded paths and options. Using pkg-config is very helpful for cross-compilation environments, and is sometimes readily available on developer boxes to ensure we get the right compiler/linker options for the given package. Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests/gpio')
-rw-r--r--tools/testing/selftests/gpio/Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 46648427d537..f22b22aef7bf 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,7 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
+MOUNT_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
+MOUNT_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
+ifeq ($(MOUNT_LDLIBS),)
+MOUNT_LDLIBS := -lmount -I/usr/include/libmount
+endif
+
+CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(MOUNT_CFLAGS)
+LDLIBS += $(MOUNT_LDLIBS)
TEST_PROGS := gpio-mockup.sh
TEST_FILES := gpio-mockup-sysfs.sh