selftests/gpio: Fix build when source tree is read only
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 4 Nov 2020 10:08:42 +0000 (21:08 +1100)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 10 Nov 2020 21:40:07 +0000 (14:40 -0700)
commitb68c1c65dec5fb5186ebd33ce52059b4c6db8500
tree6cf636ea10be20fa79ae428a8b72ec4fa2d7ec0c
parent449539da2e237336bc750b41f1736a77f9aca25c
selftests/gpio: Fix build when source tree is read only

Currently the gpio selftests fail to build if the source tree is read
only:

  make -j 160 -C tools/testing/selftests TARGETS=gpio
  make[1]: Entering directory '/linux/tools/testing/selftests/gpio'
  make OUTPUT=/linux/tools/gpio/ -C /linux/tools/gpio
  make[2]: Entering directory '/linux/tools/gpio'
  mkdir -p /linux/tools/gpio/include/linux 2>&1 || true
  ln -sf /linux/tools/gpio/../../include/uapi/linux/gpio.h /linux/tools/gpio/include/linux/gpio.h
  ln: failed to create symbolic link '/linux/tools/gpio/include/linux/gpio.h': Read-only file system

This happens because we ask make to build ../../../gpio (tools/gpio)
without pointing OUTPUT away from the source directory.

To fix it we create a subdirectory of the existing OUTPUT directory,
called tools-gpio, and tell tools/gpio to build in there.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/gpio/Makefile