Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/test/nvdimm: Fix out of tree build

Out of tree build using

make M=tools/test/nvdimm O=/tmp/build -C /tmp/build

fails with the following error

make: Entering directory '/tmp/build'
CC [M] tools/testing/nvdimm/test/nfit.o
linux/tools/testing/nvdimm/test/nfit.c:19:10: fatal error: nd-core.h: No such file or directory
19 | #include <nd-core.h>
| ^~~~~~~~~~~
compilation terminated.

That is because the kbuild file uses $(src) which points to
tools/testing/nvdimm, $(srctree) correctly points to root of the linux
source tree.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Link: https://lore.kernel.org/r/20200114054051.4115790-1-santosh@fossix.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Santosh Sivaraj and committed by
Dan Williams
1f776799 f84afbdd

+4 -4
+2 -2
tools/testing/nvdimm/Kbuild
··· 21 21 NVDIMM_SRC := $(DRIVERS)/nvdimm 22 22 ACPI_SRC := $(DRIVERS)/acpi/nfit 23 23 DAX_SRC := $(DRIVERS)/dax 24 - ccflags-y := -I$(src)/$(NVDIMM_SRC)/ 25 - ccflags-y += -I$(src)/$(ACPI_SRC)/ 24 + ccflags-y := -I$(srctree)/drivers/nvdimm/ 25 + ccflags-y += -I$(srctree)/drivers/acpi/nfit/ 26 26 27 27 obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o 28 28 obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o
+2 -2
tools/testing/nvdimm/test/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - ccflags-y := -I$(src)/../../../../drivers/nvdimm/ 3 - ccflags-y += -I$(src)/../../../../drivers/acpi/nfit/ 2 + ccflags-y := -I$(srctree)/drivers/nvdimm/ 3 + ccflags-y += -I$(srctree)/drivers/acpi/nfit/ 4 4 5 5 obj-m += nfit_test.o 6 6 obj-m += nfit_test_iomap.o