Older kernels (e.g. 2.6.38.8) don't seem to handle subdirectory in the
same way as recent kernels (e.g. 4.6). As a result, building LTTng
out-of-tree within a kernel modified to have LTTng as a built-in addon
fails with CONFIG_LTTNG=m.
$ make all O=../kernel_builddir
.....
CC [M] lttng/probes/lttng-kprobes.o
CC [M] lttng/probes/lttng-kretprobes.o
LD lttng/tests/built-in.o
CC [M] lttng/tests/probes/lttng-test.o
Assembler messages:
Fatal error: can't create lttng/tests/probes/lttng-test.o: No such
file or directory
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:264:
recipe for target 'lttng/tests/probes/lttng-test.o' failed
make[3]: *** [lttng/tests/probes/lttng-test.o] Error 2
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:403:
recipe for target 'lttng/tests' failed
make[2]: *** [lttng/tests] Error 2
/media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/Makefile:946:
recipe for target 'lttng' failed
make[1]: *** [lttng] Error 2
make[1]: Leaving directory
'/media/awallin/sda1/home/awallin/src/lttng-test/kernel_builddir'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
$tree ../kernel_builddir/lttng/tests/
../kernel_builddir/lttng/tests/
└── built-in.o
Reported-by: Anders Wallin <anders.wallin@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)
-obj-$(CONFIG_LTTNG) += probes/lttng-test.o
+obj-$(CONFIG_LTTNG) += lttng-test.o
+lttng-test-objs := probes/lttng-test.o
-obj-$(CONFIG_LTTNG) += clock-plugin/lttng-clock-plugin-test.o
+obj-$(CONFIG_LTTNG) += lttng-clock-plugin-test.o
+lttng-clock-plugin-test-objs := clock-plugin/lttng-clock-plugin-test.o
# vim:syntax=make