linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0'
@ 2018-11-23  4:51 Masahiro Yamada
  2018-11-23  4:51 ` [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile Masahiro Yamada
  2018-11-26 14:54 ` [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' Masahiro Yamada
  0 siblings, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-11-23  4:51 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Before start descending, Kbuild needs to run 'prepare' and 'scripts',
which were orthogonal to each other prior to this commit.

Let's consider 'scripts' is a part of the preparation. This will allow
more cleanups.

Move 'scripts' to the prerequisite of 'prepare0', which starts compiling
target *.c files.

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

 Makefile | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index 36f3f0e..cee4cec 100644
--- a/Makefile
+++ b/Makefile
@@ -1062,7 +1062,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
 # Error messages still appears in the original language
 
 PHONY += $(vmlinux-dirs)
-$(vmlinux-dirs): prepare scripts
+$(vmlinux-dirs): prepare
 	$(Q)$(MAKE) $(build)=$@ need-builtin=1
 
 define filechk_kernel.release
@@ -1114,7 +1114,7 @@ macroprepare: prepare1 archmacros
 
 archprepare: archheaders archscripts macroprepare scripts_basic
 
-prepare0: archprepare gcc-plugins
+prepare0: scripts archprepare gcc-plugins
 	$(Q)$(MAKE) $(build)=scripts/mod
 	$(Q)$(MAKE) $(build)=.
 
@@ -1286,7 +1286,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
 
 # Target to prepare building external modules
 PHONY += modules_prepare
-modules_prepare: prepare scripts
+modules_prepare: prepare
 
 # Target to install modules
 PHONY += modules_install
@@ -1604,11 +1604,9 @@ help:
 	@echo  '  clean           - remove generated files in module directory only'
 	@echo  ''
 
-# Dummies...
-PHONY += prepare scripts
+PHONY += prepare
 prepare:
 	$(cmd_crmodverdir)
-scripts: ;
 endif # KBUILD_EXTMOD
 
 clean: $(clean-dirs)
@@ -1712,33 +1710,33 @@ else
         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
 endif
 
-%.s: %.c prepare scripts FORCE
+%.s: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.i: %.c prepare scripts FORCE
+%.i: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.o: %.c prepare scripts FORCE
+%.o: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.lst: %.c prepare scripts FORCE
+%.lst: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.s: %.S prepare scripts FORCE
+%.s: %.S prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.o: %.S prepare scripts FORCE
+%.o: %.S prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.symtypes: %.c prepare scripts FORCE
+%.symtypes: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-%.ll: %.c prepare scripts FORCE
+%.ll: %.c prepare FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
 
 # Modules
-/: prepare scripts FORCE
+/: prepare FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
 	$(build)=$(build-dir)
 # Make sure the latest headers are built for Documentation
 Documentation/ samples/: headers_install
-%/: prepare scripts FORCE
+%/: prepare FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
 	$(build)=$(build-dir)
-%.ko: prepare scripts FORCE
+%.ko: prepare FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
 	$(build)=$(build-dir) $(@:.ko=.o)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-- 
2.7.4


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

* [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile
  2018-11-23  4:51 [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' Masahiro Yamada
@ 2018-11-23  4:51 ` Masahiro Yamada
  2018-11-26 14:54   ` Masahiro Yamada
  2018-11-27 22:02   ` Kees Cook
  2018-11-26 14:54 ` [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' Masahiro Yamada
  1 sibling, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-11-23  4:51 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, kernel-hardening, Kees Cook, linux-kernel,
	Michal Marek, Emese Revfy

Now that 'prepare0' depends on 'scripts', building GCC plugins can
go into scripts/Makefile, which is a more standard way.

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

 Makefile                     | 2 +-
 scripts/Makefile             | 3 ++-
 scripts/Makefile.gcc-plugins | 8 --------
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index cee4cec..a8bbe68 100644
--- a/Makefile
+++ b/Makefile
@@ -1114,7 +1114,7 @@ macroprepare: prepare1 archmacros
 
 archprepare: archheaders archscripts macroprepare scripts_basic
 
-prepare0: scripts archprepare gcc-plugins
+prepare0: scripts archprepare
 	$(Q)$(MAKE) $(build)=scripts/mod
 	$(Q)$(MAKE) $(build)=.
 
diff --git a/scripts/Makefile b/scripts/Makefile
index b48259d..feb1f71 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -36,9 +36,10 @@ PHONY += build_unifdef
 build_unifdef: $(obj)/unifdef
 	@:
 
+subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
 subdir-$(CONFIG_MODVERSIONS) += genksyms
 subdir-$(CONFIG_SECURITY_SELINUX) += selinux
 subdir-$(CONFIG_GDB_SCRIPTS) += gdb
 
 # Let clean descend into subdirs
-subdir-	+= basic dtc kconfig mod package gcc-plugins
+subdir-	+= basic dtc kconfig mod package
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index 46c5c68..c36f199 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -49,11 +49,3 @@ KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
 # All enabled GCC plugins are collected here for building below.
 GCC_PLUGIN := $(gcc-plugin-y)
 export GCC_PLUGIN
-
-# Actually do the build, if requested.
-PHONY += gcc-plugins
-gcc-plugins: scripts_basic
-ifdef CONFIG_GCC_PLUGINS
-	$(Q)$(MAKE) $(build)=scripts/gcc-plugins
-endif
-	@:
-- 
2.7.4


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

* Re: [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0'
  2018-11-23  4:51 [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' Masahiro Yamada
  2018-11-23  4:51 ` [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile Masahiro Yamada
@ 2018-11-26 14:54 ` Masahiro Yamada
  1 sibling, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-11-26 14:54 UTC (permalink / raw)
  To: Linux Kbuild mailing list; +Cc: Michal Marek, Linux Kernel Mailing List

On Sat, Nov 24, 2018 at 4:57 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Before start descending, Kbuild needs to run 'prepare' and 'scripts',
> which were orthogonal to each other prior to this commit.
>
> Let's consider 'scripts' is a part of the preparation. This will allow
> more cleanups.
>
> Move 'scripts' to the prerequisite of 'prepare0', which starts compiling
> target *.c files.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Applied to linux-kbuild.



>
>  Makefile | 32 +++++++++++++++-----------------
>  1 file changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 36f3f0e..cee4cec 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1062,7 +1062,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
>  # Error messages still appears in the original language
>
>  PHONY += $(vmlinux-dirs)
> -$(vmlinux-dirs): prepare scripts
> +$(vmlinux-dirs): prepare
>         $(Q)$(MAKE) $(build)=$@ need-builtin=1
>
>  define filechk_kernel.release
> @@ -1114,7 +1114,7 @@ macroprepare: prepare1 archmacros
>
>  archprepare: archheaders archscripts macroprepare scripts_basic
>
> -prepare0: archprepare gcc-plugins
> +prepare0: scripts archprepare gcc-plugins
>         $(Q)$(MAKE) $(build)=scripts/mod
>         $(Q)$(MAKE) $(build)=.
>
> @@ -1286,7 +1286,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
>
>  # Target to prepare building external modules
>  PHONY += modules_prepare
> -modules_prepare: prepare scripts
> +modules_prepare: prepare
>
>  # Target to install modules
>  PHONY += modules_install
> @@ -1604,11 +1604,9 @@ help:
>         @echo  '  clean           - remove generated files in module directory only'
>         @echo  ''
>
> -# Dummies...
> -PHONY += prepare scripts
> +PHONY += prepare
>  prepare:
>         $(cmd_crmodverdir)
> -scripts: ;
>  endif # KBUILD_EXTMOD
>
>  clean: $(clean-dirs)
> @@ -1712,33 +1710,33 @@ else
>          target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
>  endif
>
> -%.s: %.c prepare scripts FORCE
> +%.s: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.i: %.c prepare scripts FORCE
> +%.i: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.o: %.c prepare scripts FORCE
> +%.o: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.lst: %.c prepare scripts FORCE
> +%.lst: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.s: %.S prepare scripts FORCE
> +%.s: %.S prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.o: %.S prepare scripts FORCE
> +%.o: %.S prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.symtypes: %.c prepare scripts FORCE
> +%.symtypes: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
> -%.ll: %.c prepare scripts FORCE
> +%.ll: %.c prepare FORCE
>         $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
>
>  # Modules
> -/: prepare scripts FORCE
> +/: prepare FORCE
>         $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
>         $(build)=$(build-dir)
>  # Make sure the latest headers are built for Documentation
>  Documentation/ samples/: headers_install
> -%/: prepare scripts FORCE
> +%/: prepare FORCE
>         $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
>         $(build)=$(build-dir)
> -%.ko: prepare scripts FORCE
> +%.ko: prepare FORCE
>         $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
>         $(build)=$(build-dir) $(@:.ko=.o)
>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile
  2018-11-23  4:51 ` [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile Masahiro Yamada
@ 2018-11-26 14:54   ` Masahiro Yamada
  2018-11-27 22:02   ` Kees Cook
  1 sibling, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2018-11-26 14:54 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: Kernel Hardening, Kees Cook, Linux Kernel Mailing List,
	Michal Marek, Emese Revfy

On Sat, Nov 24, 2018 at 4:57 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Now that 'prepare0' depends on 'scripts', building GCC plugins can
> go into scripts/Makefile, which is a more standard way.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---


Applied to linux-kbuild.


>  Makefile                     | 2 +-
>  scripts/Makefile             | 3 ++-
>  scripts/Makefile.gcc-plugins | 8 --------
>  3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index cee4cec..a8bbe68 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1114,7 +1114,7 @@ macroprepare: prepare1 archmacros
>
>  archprepare: archheaders archscripts macroprepare scripts_basic
>
> -prepare0: scripts archprepare gcc-plugins
> +prepare0: scripts archprepare
>         $(Q)$(MAKE) $(build)=scripts/mod
>         $(Q)$(MAKE) $(build)=.
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index b48259d..feb1f71 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -36,9 +36,10 @@ PHONY += build_unifdef
>  build_unifdef: $(obj)/unifdef
>         @:
>
> +subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
>  subdir-$(CONFIG_MODVERSIONS) += genksyms
>  subdir-$(CONFIG_SECURITY_SELINUX) += selinux
>  subdir-$(CONFIG_GDB_SCRIPTS) += gdb
>
>  # Let clean descend into subdirs
> -subdir-        += basic dtc kconfig mod package gcc-plugins
> +subdir-        += basic dtc kconfig mod package
> diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
> index 46c5c68..c36f199 100644
> --- a/scripts/Makefile.gcc-plugins
> +++ b/scripts/Makefile.gcc-plugins
> @@ -49,11 +49,3 @@ KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
>  # All enabled GCC plugins are collected here for building below.
>  GCC_PLUGIN := $(gcc-plugin-y)
>  export GCC_PLUGIN
> -
> -# Actually do the build, if requested.
> -PHONY += gcc-plugins
> -gcc-plugins: scripts_basic
> -ifdef CONFIG_GCC_PLUGINS
> -       $(Q)$(MAKE) $(build)=scripts/gcc-plugins
> -endif
> -       @:
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile
  2018-11-23  4:51 ` [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile Masahiro Yamada
  2018-11-26 14:54   ` Masahiro Yamada
@ 2018-11-27 22:02   ` Kees Cook
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2018-11-27 22:02 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Kernel Hardening, LKML, Michal Marek, Emese Revfy

On Thu, Nov 22, 2018 at 8:51 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Now that 'prepare0' depends on 'scripts', building GCC plugins can
> go into scripts/Makefile, which is a more standard way.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>
>  Makefile                     | 2 +-
>  scripts/Makefile             | 3 ++-
>  scripts/Makefile.gcc-plugins | 8 --------
>  3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index cee4cec..a8bbe68 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1114,7 +1114,7 @@ macroprepare: prepare1 archmacros
>
>  archprepare: archheaders archscripts macroprepare scripts_basic
>
> -prepare0: scripts archprepare gcc-plugins
> +prepare0: scripts archprepare
>         $(Q)$(MAKE) $(build)=scripts/mod
>         $(Q)$(MAKE) $(build)=.
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index b48259d..feb1f71 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -36,9 +36,10 @@ PHONY += build_unifdef
>  build_unifdef: $(obj)/unifdef
>         @:
>
> +subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
>  subdir-$(CONFIG_MODVERSIONS) += genksyms
>  subdir-$(CONFIG_SECURITY_SELINUX) += selinux
>  subdir-$(CONFIG_GDB_SCRIPTS) += gdb
>
>  # Let clean descend into subdirs
> -subdir-        += basic dtc kconfig mod package gcc-plugins
> +subdir-        += basic dtc kconfig mod package
> diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
> index 46c5c68..c36f199 100644
> --- a/scripts/Makefile.gcc-plugins
> +++ b/scripts/Makefile.gcc-plugins
> @@ -49,11 +49,3 @@ KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
>  # All enabled GCC plugins are collected here for building below.
>  GCC_PLUGIN := $(gcc-plugin-y)
>  export GCC_PLUGIN
> -
> -# Actually do the build, if requested.
> -PHONY += gcc-plugins
> -gcc-plugins: scripts_basic
> -ifdef CONFIG_GCC_PLUGINS
> -       $(Q)$(MAKE) $(build)=scripts/gcc-plugins
> -endif
> -       @:
> --
> 2.7.4
>



-- 
Kees Cook

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

end of thread, other threads:[~2018-11-27 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23  4:51 [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' Masahiro Yamada
2018-11-23  4:51 ` [PATCH 2/2] kbuild: descend into scripts/gcc-plugins/ via scripts/Makefile Masahiro Yamada
2018-11-26 14:54   ` Masahiro Yamada
2018-11-27 22:02   ` Kees Cook
2018-11-26 14:54 ` [PATCH 1/2] kbuild: make 'scripts' depend on 'prepare0' 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).