linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
@ 2018-09-18  8:45 Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 2/4] kbuild: remove user ID check in scripts/mkmakefile Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-09-18  8:45 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Neither VERSION nor PATCHLEVEL is used in any useful way.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile           | 3 +--
 scripts/mkmakefile | 6 ------
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index d2976b5..6e1a059 100644
--- a/Makefile
+++ b/Makefile
@@ -482,8 +482,7 @@ PHONY += outputmakefile
 outputmakefile:
 ifneq ($(KBUILD_SRC),)
 	$(Q)ln -fsn $(srctree) source
-	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
-	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree)
 endif
 
 ifeq ($(cc-name),clang)
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e19d656..e2106444 100755
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -7,9 +7,6 @@
 # Usage
 # $1 - Kernel src directory
 # $2 - Output directory
-# $3 - version
-# $4 - patchlevel
-
 
 test ! -r $2/Makefile -o -O $2/Makefile || exit 0
 # Only overwrite automatically generated Makefiles
@@ -25,9 +22,6 @@ fi
 cat << EOF > $2/Makefile
 # Automatically generated by $0: don't edit
 
-VERSION = $3
-PATCHLEVEL = $4
-
 lastword = \$(word \$(words \$(1)),\$(1))
 makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] kbuild: remove user ID check in scripts/mkmakefile
  2018-09-18  8:45 [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
@ 2018-09-18  8:45 ` Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 3/4] kbuild: do not pass $(objtree) to scripts/mkmakefile Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-09-18  8:45 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

This line was added by commit fd5f0cd6b0ce ("kbuild: Do not overwrite
makefile as anohter user").  Its commit description says the intention
was to prevent $(objtree)/Makefile from being owned by root when e.g.
running 'make install'.

However, as commit 19514fc665ff ("arm, kbuild: make "make install" not
depend on vmlinux") stated, installation targets must not modify the
source tree in the first place.  If they do, we are already screwed up.
We must fix the root cause.

Installation targets should just copy files verbatim, hence we never
expect $(objtree)/Makefile is touched by root.  The user ID check in
scripts/mkmakefile is unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/mkmakefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index e2106444..2435428 100755
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -8,7 +8,6 @@
 # $1 - Kernel src directory
 # $2 - Output directory
 
-test ! -r $2/Makefile -o -O $2/Makefile || exit 0
 # Only overwrite automatically generated Makefiles
 # (so we do not overwrite kernel Makefile)
 if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] kbuild: do not pass $(objtree) to scripts/mkmakefile
  2018-09-18  8:45 [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 2/4] kbuild: remove user ID check in scripts/mkmakefile Masahiro Yamada
@ 2018-09-18  8:45 ` Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 4/4] kbuild: simplify command line creation in scripts/mkmakefile Masahiro Yamada
  2018-09-30 13:51 ` [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-09-18  8:45 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Since $(objtree) is always '.', it is not useful to pass it to
scripts/mkmakefile.  I assume nobody wants to run this script directly.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile           | 2 +-
 scripts/mkmakefile | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 6e1a059..3799bc5 100644
--- a/Makefile
+++ b/Makefile
@@ -482,7 +482,7 @@ PHONY += outputmakefile
 outputmakefile:
 ifneq ($(KBUILD_SRC),)
 	$(Q)ln -fsn $(srctree) source
-	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
 endif
 
 ifeq ($(cc-name),clang)
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index 2435428..85995f9 100755
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -6,19 +6,18 @@
 
 # Usage
 # $1 - Kernel src directory
-# $2 - Output directory
 
 # Only overwrite automatically generated Makefiles
 # (so we do not overwrite kernel Makefile)
-if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
+if test -e Makefile && ! grep -q Automatically Makefile
 then
 	exit 0
 fi
 if [ "${quiet}" != "silent_" ]; then
-	echo "  GEN     $2/Makefile"
+	echo "  GEN     Makefile"
 fi
 
-cat << EOF > $2/Makefile
+cat << EOF > Makefile
 # Automatically generated by $0: don't edit
 
 lastword = \$(word \$(words \$(1)),\$(1))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] kbuild: simplify command line creation in scripts/mkmakefile
  2018-09-18  8:45 [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 2/4] kbuild: remove user ID check in scripts/mkmakefile Masahiro Yamada
  2018-09-18  8:45 ` [PATCH 3/4] kbuild: do not pass $(objtree) to scripts/mkmakefile Masahiro Yamada
@ 2018-09-18  8:45 ` Masahiro Yamada
  2018-09-30 13:51 ` [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-09-18  8:45 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Assuming we never invoke the generated Makefile from outside of
the $(objtree) directory, $(CURDIR) points to the absolute path
of $(objtree).

BTW, 'lastword' is natively supported by GNU Make 3.81+, which
is the current requirement for building the kernel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/mkmakefile | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index 85995f9..412f13f 100755
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -20,9 +20,6 @@ fi
 cat << EOF > Makefile
 # Automatically generated by $0: don't edit
 
-lastword = \$(word \$(words \$(1)),\$(1))
-makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
-
 ifeq ("\$(origin V)", "command line")
 VERBOSE := \$(V)
 endif
@@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1)
 Q := @
 endif
 
-MAKEARGS := -C $1
-MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
-
 MAKEFLAGS += --no-print-directory
 
 .PHONY: __sub-make \$(MAKECMDGOALS)
 
 __sub-make:
-	\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
+	\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
 
 \$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
 	@:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
  2018-09-18  8:45 [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
                   ` (2 preceding siblings ...)
  2018-09-18  8:45 ` [PATCH 4/4] kbuild: simplify command line creation in scripts/mkmakefile Masahiro Yamada
@ 2018-09-30 13:51 ` Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-09-30 13:51 UTC (permalink / raw)
  To: Linux Kbuild mailing list; +Cc: Michal Marek, Linux Kernel Mailing List

2018年9月18日(火) 17:46 Masahiro Yamada <yamada.masahiro@socionext.com>:
>
> Neither VERSION nor PATCHLEVEL is used in any useful way.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Series, applies to linux-kbuild.


>  Makefile           | 3 +--
>  scripts/mkmakefile | 6 ------
>  2 files changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d2976b5..6e1a059 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -482,8 +482,7 @@ PHONY += outputmakefile
>  outputmakefile:
>  ifneq ($(KBUILD_SRC),)
>         $(Q)ln -fsn $(srctree) source
> -       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
> -           $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
> +       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree)
>  endif
>
>  ifeq ($(cc-name),clang)
> diff --git a/scripts/mkmakefile b/scripts/mkmakefile
> index e19d656..e2106444 100755
> --- a/scripts/mkmakefile
> +++ b/scripts/mkmakefile
> @@ -7,9 +7,6 @@
>  # Usage
>  # $1 - Kernel src directory
>  # $2 - Output directory
> -# $3 - version
> -# $4 - patchlevel
> -
>
>  test ! -r $2/Makefile -o -O $2/Makefile || exit 0
>  # Only overwrite automatically generated Makefiles
> @@ -25,9 +22,6 @@ fi
>  cat << EOF > $2/Makefile
>  # Automatically generated by $0: don't edit
>
> -VERSION = $3
> -PATCHLEVEL = $4
> -
>  lastword = \$(word \$(words \$(1)),\$(1))
>  makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
>
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-30 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18  8:45 [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada
2018-09-18  8:45 ` [PATCH 2/4] kbuild: remove user ID check in scripts/mkmakefile Masahiro Yamada
2018-09-18  8:45 ` [PATCH 3/4] kbuild: do not pass $(objtree) to scripts/mkmakefile Masahiro Yamada
2018-09-18  8:45 ` [PATCH 4/4] kbuild: simplify command line creation in scripts/mkmakefile Masahiro Yamada
2018-09-30 13:51 ` [PATCH 1/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Masahiro Yamada

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).