kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
Subsystems (2)
Nicolas Schier
maintainerPATCH RESEND 1/1 kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
From: Nicolas Schier <[email protected]>
Update output Makefile in the corresponding tree only: for out-of-source in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.
In-source builds are not affected.
Since commit c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree"), building out-of-tree kernel modules out-of-source (make M=... MO=...) causes a rewrite of $(objtree)/Makefile with KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT being set. That is problematic:
* $(objtree)/ must not be changed in any way when building out-of-tree modules as it breaks other uses of $(objtree).
* Setting KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT in $(objtree)/Makefile kills the tree for incremental builds that start right there ('make -C $(objtree)'); builds starting in $(srctree) reset $(objtree)/Makefile to its original content.
Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at all.
This commit restores the previous kbuild behaviour prior to commit c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree") but leaves in-place the use of filechk for output spam reduction.
--- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Makefile +3 -5
@@ -695,13 +695,11 @@ filechk_makefile = { \ echo "include $(abs_srctree)/Makefile"; \ } -$(objtree)/Makefile: FORCE +PHONY += $(CURDIR)/Makefile +$(CURDIR)/Makefile: FORCE $(call filechk,makefile) -# Prevent $(srcroot)/Makefile from inhibiting the rule to run. -PHONY += $(objtree)/Makefile - -outputmakefile: $(objtree)/Makefile +outputmakefile: $(CURDIR)/Makefile ifeq ($(KBUILD_EXTMOD),) @if [ -f $(srctree)/.config -o \ -d $(srctree)/include/config -o \
Signature · 1 line
2.47.3
Quoted 26 lines
Update output
Makefilein the corresponding tree only: for out-of-source in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.In-source builds are not affected.
Since commit
c9bb03ac2c66("kbuild: reduce output spam when building out of tree"), building out-of-tree kernel modules out-of-source (make M=... MO=...) causes a rewrite of $(objtree)/Makefile withKBUILD_EXTMODandKBUILD_EXTMOD_OUTPUTbeing set. That is problematic:* $(objtree)/ must not be changed in any way when building out-of-tree modules as it breaks other uses of $(objtree).
* Setting
KBUILD_EXTMODandKBUILD_EXTMOD_OUTPUTin $(objtree)/Makefile kills the tree for incremental builds that start right there ('make -C $(objtree)'); builds starting in $(srctree) reset $(objtree)/Makefile to its original content.Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at all.
This commit restores the previous kbuild behaviour prior to commit
c9bb03ac2c66("kbuild: reduce output spam when building out of tree") but leaves in-place the use of filechk for output spam reduction.
Quoted 8 lines
Fixes c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")Reported-by Anish Rashinkar <[email protected]>Closes https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com open hereTested-by Philipp Hahn <[email protected]>Reviewed-by Philipp Hahn <[email protected]>Signed-off-by Nicolas Schier <[email protected]>Signed-off-by Nicolas Schier <[email protected]>
Thanks!
Do you want me to take this via kbuild-fixes?
Signature · 2 lines
Cheers, Nathan
Nicolas Schier
maintainerQuoted 35 lines · Nathan Chancellor
Quoted 26 lines
Update output
Makefilein the corresponding tree only: for out-of-source in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.In-source builds are not affected.
Since commit
c9bb03ac2c66("kbuild: reduce output spam when building out of tree"), building out-of-tree kernel modules out-of-source (make M=... MO=...) causes a rewrite of $(objtree)/Makefile withKBUILD_EXTMODandKBUILD_EXTMOD_OUTPUTbeing set. That is problematic:* $(objtree)/ must not be changed in any way when building out-of-tree modules as it breaks other uses of $(objtree).
* Setting
KBUILD_EXTMODandKBUILD_EXTMOD_OUTPUTin $(objtree)/Makefile kills the tree for incremental builds that start right there ('make -C $(objtree)'); builds starting in $(srctree) reset $(objtree)/Makefile to its original content.Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at all.
This commit restores the previous kbuild behaviour prior to commit
c9bb03ac2c66("kbuild: reduce output spam when building out of tree") but leaves in-place the use of filechk for output spam reduction.Quoted 8 lines
Fixes c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")Reported-by Anish Rashinkar <[email protected]>Closes https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com open hereTested-by Philipp Hahn <[email protected]>Reviewed-by Philipp Hahn <[email protected]>Signed-off-by Nicolas Schier <[email protected]>Signed-off-by Nicolas Schier <[email protected]>
Quoted 6 lines
Thanks!
Reviewed-by Nathan Chancellor <[email protected]>Tested-by Nathan Chancellor <[email protected]>Do you want me to take this via kbuild-fixes?
Yes, please take it via kbuild-fixes, as it actually breaks build trees.
Thanks!
Signature · 1 line
Nicolas
Nathan Chancellor
maintainerQuoted 1 line · Nicolas Schier
kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes-unstable
Thanks!
[1/1] kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
https://git.kernel.org/kbuild/c/39d6e68f50f4a
Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped or reverted. Patches applied to an "unstable" branch are accepted pending wider testing in -next and any post-commit review; they will generally be moved to the main branch in a week if no issues are found.
Best regards,
Signature · 2 lines
Cheers, Nathan