* [PATCH v2] kbuild: add workaround for Debian make-kpkg
@ 2019-03-08 9:13 Masahiro Yamada
2019-03-13 17:44 ` Masahiro Yamada
2019-03-18 10:00 ` Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2019-03-08 9:13 UTC (permalink / raw)
To: linux-kbuild
Cc: Ben Hutchings, Riku Voipio, Manoj Srivastava, Liz Zhang,
Lili Deng, Manoj Srivastava, Masahiro Yamada, Michal Marek,
linux-kernel
Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
Makefile for old Make versions"), make-kpkg is not working.
make-kpkg directly includes the top Makefile of Linux kernel, and
appends some debian_* targets.
/usr/share/kernel-package/ruleset/kernel_version.mk:
# Include the kernel makefile
override dot-config := 1
include Makefile
dot-config := 1
I did not know the kernel Makefile was used in that way, and it is
hard to guarantee the behavior when the kernel Makefile is included
by another Makefile from a different project.
It looks like Debian Stretch stopped providing make-kpkg. Maybe it is
obsolete and being replaced with 'make deb-pkg' etc. but still widely
used.
This commit adds a workaround; if the top Makefile is included by
another Makefile, skip sub-make in order to make the main part visible.
'MAKEFLAGS += -rR' does not become effective for GNU Make < 4.0, but
Debian/Ubuntu is already using newer versions.
The effect of this commit:
Debian 8 (Jessie) : Fixed
Debian 9 (Stretch) : make-kpkg (kernel-package) is not provided
Ubuntu 14.04 LTS : NOT Fixed
Ubuntu 16.04 LTS : Fixed
Ubuntu 18.04 LTS : Fixed
This commit cannot fix Ubuntu 14.04 because it installs GNU Make 3.81,
but its support will end in Apr 2019, which is before the Linux v5.1
release.
I added warning so that nobody would try to include the top Makefile.
Fixes: 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
Reported-by: Liz Zhang <lizzha@microsoft.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Lili Deng <v-lide@microsoft.com>
Cc: Manoj Srivastava <srivasta@debian.org>
---
Changes in v2:
- Drop the unimportant comment about PowerPC
Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Makefile b/Makefile
index 4fb8896..6039685 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,16 @@ _all:
# descending is started. They are now explicitly listed as the
# prepare rule.
+# Ugly workaround for Debian make-kpkg:
+# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
+# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
+# displays warning to discourage such abusage.
+ifneq ($(word 2, $(MAKEFILE_LIST)),)
+$(warning Do not include top Makefile of Linux Kernel)
+sub-make-done := 1
+MAKEFLAGS += -rR
+endif
+
ifneq ($(sub-make-done),1)
# Do not use make's built-in rules and variables
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kbuild: add workaround for Debian make-kpkg
2019-03-08 9:13 [PATCH v2] kbuild: add workaround for Debian make-kpkg Masahiro Yamada
@ 2019-03-13 17:44 ` Masahiro Yamada
2019-03-18 10:00 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2019-03-13 17:44 UTC (permalink / raw)
To: Linux Kbuild mailing list
Cc: Ben Hutchings, Riku Voipio, Manoj Srivastava, Liz Zhang,
Lili Deng, Manoj Srivastava, Michal Marek,
Linux Kernel Mailing List
On Fri, Mar 8, 2019 at 6:15 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top
> Makefile for old Make versions"), make-kpkg is not working.
>
> make-kpkg directly includes the top Makefile of Linux kernel, and
> appends some debian_* targets.
>
> /usr/share/kernel-package/ruleset/kernel_version.mk:
>
> # Include the kernel makefile
> override dot-config := 1
> include Makefile
> dot-config := 1
>
> I did not know the kernel Makefile was used in that way, and it is
> hard to guarantee the behavior when the kernel Makefile is included
> by another Makefile from a different project.
>
> It looks like Debian Stretch stopped providing make-kpkg. Maybe it is
> obsolete and being replaced with 'make deb-pkg' etc. but still widely
> used.
>
> This commit adds a workaround; if the top Makefile is included by
> another Makefile, skip sub-make in order to make the main part visible.
> 'MAKEFLAGS += -rR' does not become effective for GNU Make < 4.0, but
> Debian/Ubuntu is already using newer versions.
>
> The effect of this commit:
>
> Debian 8 (Jessie) : Fixed
> Debian 9 (Stretch) : make-kpkg (kernel-package) is not provided
> Ubuntu 14.04 LTS : NOT Fixed
> Ubuntu 16.04 LTS : Fixed
> Ubuntu 18.04 LTS : Fixed
>
> This commit cannot fix Ubuntu 14.04 because it installs GNU Make 3.81,
> but its support will end in Apr 2019, which is before the Linux v5.1
> release.
>
> I added warning so that nobody would try to include the top Makefile.
>
> Fixes: 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
> Reported-by: Liz Zhang <lizzha@microsoft.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Tested-by: Lili Deng <v-lide@microsoft.com>
> Cc: Manoj Srivastava <srivasta@debian.org>
> ---
Applied to linux-kbuild.
> Changes in v2:
> - Drop the unimportant comment about PowerPC
>
> Makefile | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 4fb8896..6039685 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -31,6 +31,16 @@ _all:
> # descending is started. They are now explicitly listed as the
> # prepare rule.
>
> +# Ugly workaround for Debian make-kpkg:
> +# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
> +# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
> +# displays warning to discourage such abusage.
> +ifneq ($(word 2, $(MAKEFILE_LIST)),)
> +$(warning Do not include top Makefile of Linux Kernel)
> +sub-make-done := 1
> +MAKEFLAGS += -rR
> +endif
> +
> ifneq ($(sub-make-done),1)
>
> # Do not use make's built-in rules and variables
> --
> 2.7.4
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kbuild: add workaround for Debian make-kpkg
2019-03-08 9:13 [PATCH v2] kbuild: add workaround for Debian make-kpkg Masahiro Yamada
2019-03-13 17:44 ` Masahiro Yamada
@ 2019-03-18 10:00 ` Andreas Schwab
2019-03-19 4:09 ` Masahiro Yamada
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2019-03-18 10:00 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Ben Hutchings, Riku Voipio, Manoj Srivastava,
Liz Zhang, Lili Deng, Manoj Srivastava, Michal Marek,
linux-kernel
On Mär 08 2019, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> +$(warning Do not include top Makefile of Linux Kernel)
So how do I add additional targets then? Currently I create
GNUmakefile, include Makefile, then add the targets I need. It seems
this is now broken.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kbuild: add workaround for Debian make-kpkg
2019-03-18 10:00 ` Andreas Schwab
@ 2019-03-19 4:09 ` Masahiro Yamada
2019-03-19 8:42 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2019-03-19 4:09 UTC (permalink / raw)
To: Andreas Schwab
Cc: Linux Kbuild mailing list, Ben Hutchings, Riku Voipio,
Manoj Srivastava, Liz Zhang, Lili Deng, Manoj Srivastava,
Michal Marek, Linux Kernel Mailing List
Hi Andreas,
On Mon, Mar 18, 2019 at 7:00 PM Andreas Schwab <schwab@suse.de> wrote:
>
> On Mär 08 2019, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>
> > +$(warning Do not include top Makefile of Linux Kernel)
>
> So how do I add additional targets then? Currently I create
> GNUmakefile, include Makefile, then add the targets I need. It seems
> this is now broken.
---------(GNUmakefile BEGIN)-----------
your-own-target1:
echo hello
your-own-target2:
echo world
# For the rest, fall back to the kernel Makefile
%:
$(MAKE) -f Makefile $@
---------(GNUmakefile END)-----------
Having said that, my previous cheesy workaround sucks.
How about this patch?
https://patchwork.kernel.org/patch/10858809/
I hope you will be able to wrap the top Makefile again.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kbuild: add workaround for Debian make-kpkg
2019-03-19 4:09 ` Masahiro Yamada
@ 2019-03-19 8:42 ` Andreas Schwab
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2019-03-19 8:42 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Ben Hutchings, Riku Voipio,
Manoj Srivastava, Liz Zhang, Lili Deng, Manoj Srivastava,
Michal Marek, Linux Kernel Mailing List
On Mär 19 2019, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> How about this patch?
> https://patchwork.kernel.org/patch/10858809/
Thanks, this makes it work again.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-19 8:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 9:13 [PATCH v2] kbuild: add workaround for Debian make-kpkg Masahiro Yamada
2019-03-13 17:44 ` Masahiro Yamada
2019-03-18 10:00 ` Andreas Schwab
2019-03-19 4:09 ` Masahiro Yamada
2019-03-19 8:42 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).