lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170324115527.26472-1-fathi.boudra@linaro.org>
Date:   Fri, 24 Mar 2017 13:55:27 +0200
From:   Fathi Boudra <fathi.boudra@...aro.org>
To:     linux-kselftest@...r.kernel.org, Shuah Khan <shuah@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>,
        Fathi Boudra <fathi.boudra@...aro.org>
Subject: [PATCH] selftests: gpio: fix Makefile

* Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
  figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.

* Fix the clean target to clean up also gpio-utils.

* Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
  instead of BINARIES which is not supported by the top-level lib.mk.

* Remove dependency to headers_install as we can simply use gpio.h from
  user space API directly.

* Improve readibility:
  - introduce GPIODIR/GPIOOBJ variables
  - split CFLAGS on multiple lines

Signed-off-by: Fathi Boudra <fathi.boudra@...aro.org>
---
 tools/testing/selftests/gpio/Makefile | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..714f1f7df04d 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,23 +1,24 @@
+CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -I../../../../include/uapi/ -I../../../../include/
+CFLAGS += $(shell pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 TEST_PROGS := gpio-mockup.sh
-TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
-BINARIES := gpio-mockup-chardev
+TEST_PROGS_EXTENDED := gpio-mockup-chardev
+TEST_FILES := gpio-mockup-sysfs.sh
+
+GPIODIR := ../../../gpio
+GPIOOBJ := gpio-utils.o
 
 include ../lib.mk
 
-all: $(BINARIES)
+all: $(TEST_PROGS_EXTENDED)
 
 clean:
-	$(RM) $(BINARIES)
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
-
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
-
-../../../gpio/gpio-utils.o:
-	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+	$(RM) $(TEST_PROGS_EXTENDED)
+	$(MAKE) -C $(GPIODIR) clean
 
-../../../../usr/include/linux/gpio.h:
-	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
+$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
 
+$(GPIODIR)/$(GPIOOBJ):
+	$(MAKE) -C $(GPIODIR)
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ