diff mbox series

[1/4] kbuild: merge scripts/mkmakefile to top Makefile

Message ID 20210517070314.1428091-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/4] kbuild: merge scripts/mkmakefile to top Makefile | expand

Commit Message

Masahiro Yamada May 17, 2021, 7:03 a.m. UTC
scripts/mkmakefile is simple enough to be merged in the Makefile.

Use $(call cmd,...) to show the log instead of doing it in the
shell script.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Makefile           | 15 ++++++++++++---
 scripts/mkmakefile | 17 -----------------
 2 files changed, 12 insertions(+), 20 deletions(-)
 delete mode 100755 scripts/mkmakefile

Comments

Masahiro Yamada May 26, 2021, 2:29 p.m. UTC | #1
On Mon, May 17, 2021 at 4:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> scripts/mkmakefile is simple enough to be merged in the Makefile.
>
> Use $(call cmd,...) to show the log instead of doing it in the
> shell script.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Applied to linux-kbuild.


>  Makefile           | 15 ++++++++++++---
>  scripts/mkmakefile | 17 -----------------
>  2 files changed, 12 insertions(+), 20 deletions(-)
>  delete mode 100755 scripts/mkmakefile
>
> diff --git a/Makefile b/Makefile
> index 15b6476d0f89..50776cc3e894 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -544,14 +544,24 @@ scripts_basic:
>         $(Q)rm -f .tmp_quiet_recordmcount
>
>  PHONY += outputmakefile
> +ifdef building_out_of_srctree
>  # Before starting out-of-tree build, make sure the source tree is clean.
>  # outputmakefile generates a Makefile in the output directory, if using a
>  # separate output directory. This allows convenient use of make in the
>  # output directory.
>  # At the same time when output Makefile generated, generate .gitignore to
>  # ignore whole output directory
> -outputmakefile:
> -ifdef building_out_of_srctree
> +
> +quiet_cmd_makefile = GEN     $@
> +      cmd_makefile = { \
> +       echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
> +       echo "include $(srctree)/Makefile"; \
> +       } > $@
> +
> +Makefile: FORCE
> +       $(call cmd,makefile)
> +
> +outputmakefile: Makefile
>         $(Q)if [ -f $(srctree)/.config -o \
>                  -d $(srctree)/include/config -o \
>                  -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
> @@ -562,7 +572,6 @@ ifdef building_out_of_srctree
>                 false; \
>         fi
>         $(Q)ln -fsn $(srctree) source
> -       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
>         $(Q)test -e .gitignore || \
>         { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
>  endif
> diff --git a/scripts/mkmakefile b/scripts/mkmakefile
> deleted file mode 100755
> index 1cb174751429..000000000000
> --- a/scripts/mkmakefile
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#!/bin/sh
> -# SPDX-License-Identifier: GPL-2.0
> -# Generates a small Makefile used in the root of the output
> -# directory, to allow make to be started from there.
> -# The Makefile also allow for more convinient build of external modules
> -
> -# Usage
> -# $1 - Kernel src directory
> -
> -if [ "${quiet}" != "silent_" ]; then
> -       echo "  GEN     Makefile"
> -fi
> -
> -cat << EOF > Makefile
> -# Automatically generated by $0: don't edit
> -include $1/Makefile
> -EOF
> --
> 2.27.0
>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 15b6476d0f89..50776cc3e894 100644
--- a/Makefile
+++ b/Makefile
@@ -544,14 +544,24 @@  scripts_basic:
 	$(Q)rm -f .tmp_quiet_recordmcount
 
 PHONY += outputmakefile
+ifdef building_out_of_srctree
 # Before starting out-of-tree build, make sure the source tree is clean.
 # outputmakefile generates a Makefile in the output directory, if using a
 # separate output directory. This allows convenient use of make in the
 # output directory.
 # At the same time when output Makefile generated, generate .gitignore to
 # ignore whole output directory
-outputmakefile:
-ifdef building_out_of_srctree
+
+quiet_cmd_makefile = GEN     $@
+      cmd_makefile = { \
+	echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
+	echo "include $(srctree)/Makefile"; \
+	} > $@
+
+Makefile: FORCE
+	$(call cmd,makefile)
+
+outputmakefile: Makefile
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
@@ -562,7 +572,6 @@  ifdef building_out_of_srctree
 		false; \
 	fi
 	$(Q)ln -fsn $(srctree) source
-	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
 	$(Q)test -e .gitignore || \
 	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
 endif
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
deleted file mode 100755
index 1cb174751429..000000000000
--- a/scripts/mkmakefile
+++ /dev/null
@@ -1,17 +0,0 @@ 
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# Generates a small Makefile used in the root of the output
-# directory, to allow make to be started from there.
-# The Makefile also allow for more convinient build of external modules
-
-# Usage
-# $1 - Kernel src directory
-
-if [ "${quiet}" != "silent_" ]; then
-	echo "  GEN     Makefile"
-fi
-
-cat << EOF > Makefile
-# Automatically generated by $0: don't edit
-include $1/Makefile
-EOF