[PATCH 2/3] selftests/gpio: fix build error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While building selftests/gpio, gpio-utils from linux/tools/gpio as built
in the process as well. However, the OUTPUT make variable usage in
selftests breaks the build system in linux/tools/gpio resulting in its
output files placed in the selftests folder (due to lack of trailing
slash in the path, the files are placed directly in selftests):

make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
CC    linux/tools/testing/selftests/gpiolsgpio.o
CC    linux/tools/testing/selftests/gpiogpio-utils.o
LD    linux/tools/testing/selftests/gpiolsgpio-in.o

This pollutes the selftests directory and, most importantly, makes it
impossible for selftests/gpio to find the object file it's looking for
to link the test:

cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
gpio-mockup-chardev
gcc: error: ../../../gpio/gpio-utils.o: No such file or directory

Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
make to ensure it's built where expected.

Note, that this solution is not ideal as the output is placed in
linux/tools/gpio rather than a location relative to OUTPUT, but this at
least ensures the build succeeds.
Due to differences and complexities of selftests and linux/tools build
systems, it's not trivial to ensure linux/tools get built properly when
invoked recursively from selftests build and this is left as a future
task to resolve properly.

Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@xxxxxxxxxx>
---
 tools/testing/selftests/gpio/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 298929d..950956e 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -23,7 +23,7 @@ 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
+	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio OUTPUT=
 
 ../../../../usr/include/linux/gpio.h:
 	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux