[RFC][PATCH] build: Deal with change in "make --no-print-directory" behaviour change

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

 



Hi Masahiro & the kbuild crew,

Here's a patch to fix a change in make behaviour in make-4.4.  It's almost
certainly the wrong solution, but it works for me for now.

Note that I tried just adding "--print-directory" to the $(MAKE) line after
the line I added, and that does seem to work - but it then prints a lot of
additional "entering directory" lines (though they all seem to be the same).

David
---
Emacs (and probably other IDEs) parse the "make: Entering directory" lines
in the build output so that they can correctly resolve relative pathnames
in messages from the compiler.  However, a change in make has broken this.
I think it might be:

        [/usr/share/doc/make/NEWS]
        ...
        Version 4.4 (31 Oct 2022)
        ...
        * WARNING: Backward-incompatibility!
          Previously if --no-print-directory was seen anywhere in the environment or
          command line it would take precedence over any --print-directory.  Now, the
          last setting of directory printing options seen will be used, so a command
          line such as "--no-print-directory -w" _will_ show directory entry/exits.

Doing a kernel build now only prints the directory passed to the "-C" flag
if present and no other directories.  This includes any build directory
indicated with "O=".  So if I do:

        make -C /my/data/linux O=build

I see:

        make: Entering directory '/my/data/linux'

and all the path in messages emitted by the compiler are prefixed with ".."
- but then doing "M-x next-error" in emacs will prompt emacs to ask where
the file is rather than jumping to it because it can't find it.

On the previous version of Fedora with make-4.3, an extra line is emitted
by make:

        make[1]: Entering directory '/my/data/linux/build'

and that was sufficient for emacs to be able to resolve paths.

Fix this by manually printing the missing line.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
cc: Nathan Chancellor <nathan@xxxxxxxxxx>
cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
cc: Nicolas Schier <nicolas@xxxxxxxxx>
cc: linux-kbuild@xxxxxxxxxxxxxxx
---
 Makefile |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 836643eaefee..7f7c75087626 100644
--- a/Makefile
+++ b/Makefile
@@ -223,6 +223,7 @@ $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
 
 # Invoke a second make in the output directory, passing relevant variables
 __sub-make:
+	@echo "make[1]: Entering directory '$(abs_objtree)'"
 	$(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
 
 endif # need-sub-make





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux