mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
kbuild: remove trailing slashes from $(KBUILD_EXTMOD)
M= (or KBUILD_EXTMOD) generally expects a directory path without any trailing slashes, like M=a/b/c. If you add a trailing slash, like M=a/b/c/, you will get ugly build logs (two slashes in a series), but it still works fine as long as it is consistent between 'make modules' and 'make modules_install'. The following commands correctly build and install the modules. $ make M=a/b/c/ modules $ sudo make M=a/b/c/ modules_install Since commitccae4cfa7b
("kbuild: refactor scripts/Makefile.modinst"), a problem happens if you add a trailing slash only for modules_install. $ make M=a/b/c modules $ sudo make M=a/b/c/ modules_install No module is installed in this case, Johannes Berg reported. [1] Trim any trailing slashes from $(KBUILD_EXTMOD). I used the 'dirname' command to remove all the trailing slashes in case someone adds more slashes like M=a/b/c/////. The Make's built-in function, $(dir ...) cannot take care of such a case. [1]: https://lore.kernel.org/lkml/10cc8522b27a051e6a9c3e158a4c4b6414fd04a0.camel@sipsolutions.net/ Fixes:ccae4cfa7b
("kbuild: refactor scripts/Makefile.modinst") Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
c7c90e121e
commit
74ee585b7e
5
Makefile
5
Makefile
@ -129,6 +129,11 @@ endif
|
||||
$(if $(word 2, $(KBUILD_EXTMOD)), \
|
||||
$(error building multiple external modules is not supported))
|
||||
|
||||
# Remove trailing slashes
|
||||
ifneq ($(filter %/, $(KBUILD_EXTMOD)),)
|
||||
KBUILD_EXTMOD := $(shell dirname $(KBUILD_EXTMOD).)
|
||||
endif
|
||||
|
||||
export KBUILD_EXTMOD
|
||||
|
||||
# Kbuild will save output files in the current working directory.
|
||||
|
Loading…
Reference in New Issue
Block a user