[PATCH] kbuild: Print the name of the build directory

From: Michal Marek
Date: Wed Jul 02 2014 - 08:28:26 EST


With commit 9da0763b (kbuild: Use relative path when building in a
subdir of the source tree), the compiler messages include relative
paths. These are however relative to the build directory, not the
directory where make was started. Print the "Entering directory ..."
message once, so that IDEs/editors can find the source files.

Signed-off-by: Michal Marek <mmarek@xxxxxxx>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 97b2861..40544a0 100644
--- a/Makefile
+++ b/Makefile
@@ -126,7 +126,10 @@ PHONY += $(MAKECMDGOALS) sub-make
$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
@:

+# Fake the "Entering directory" message once, so that IDEs/editors are
+# able to understand relative filenames.
sub-make: FORCE
+ @echo "make[1]: Entering directory \`$(KBUILD_OUTPUT)'"
$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
KBUILD_SRC=$(CURDIR) \
KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
--
1.8.4.5



> I suspect the correct fix from make's point of view is to issue the build
> command in the build tree and use VPATH to refer to the source, but that would
> likely involve making a lot of Makefiles and would involve a step equivalent
> to autoconf - which is probably not what we want.

The build does run in the build tree with VPATH = $(srctree). The first
make just passes over to a make -C $(objtree).

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/