diff mbox series

[RFC,01/11] kbuild: ignore .config rule for make --always-make

Message ID 20240819160309.2218114-2-vegard.nossum@oracle.com (mailing list archive)
State Handled Elsewhere
Headers show
Series output a valid shell script when running 'make -n' | expand

Commit Message

Vegard Nossum Aug. 19, 2024, 4:02 p.m. UTC
Before this patch, using 'make --always-make' would always result in the
error message about the missing .config being displayed.

Detect the -B/--always-make flag and leave this rule out, which allows the
rest of the build to proceed. See [1] for an explanation of this particular
construction.

[1]: https://www.gnu.org/software/make/manual/make.html#Testing-Flags

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nicolas Schier Nov. 2, 2024, 9:07 p.m. UTC | #1
On Mon, Aug 19, 2024 at 06:02:58PM +0200 Vegard Nossum wrote:
> Before this patch, using 'make --always-make' would always result in the
> error message about the missing .config being displayed.
> 
> Detect the -B/--always-make flag and leave this rule out, which allows the
> rest of the build to proceed. See [1] for an explanation of this particular
> construction.

Nice catch, thanks.

> 
> [1]: https://www.gnu.org/software/make/manual/make.html#Testing-Flags
> 
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 44c02a6f60a14..f09c036daf2f5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -757,6 +757,10 @@ ifdef may-sync-config
>  # because some architectures define CROSS_COMPILE there.
>  include include/config/auto.conf.cmd
>  
> +ifeq (,$(findstring B,$(firstword -$(MAKEFLAGS))))

As we still also support make v3.80 to v4.0, please use $(short-opts)
defined around line 27.

> +# This is a dummy target, only meant as a help for the user invoking make.
> +# We don't want it to take effect when running 'make --always-make', since
> +# that renders the --always-make option effectively useless.
>  $(KCONFIG_CONFIG):
>  	@echo >&2 '***'
>  	@echo >&2 '*** Configuration file "$@" not found!'
> @@ -765,6 +769,7 @@ $(KCONFIG_CONFIG):
>  	@echo >&2 '*** "make menuconfig" or "make xconfig").'
>  	@echo >&2 '***'
>  	@/bin/false
> +endif
>  
>  # The actual configuration files used during the build are stored in
>  # include/generated/ and include/config/. Update them if .config is newer than
> -- 
> 2.34.1
>
Miguel Ojeda Nov. 2, 2024, 9:39 p.m. UTC | #2
On Sat, Nov 2, 2024 at 10:08 PM Nicolas Schier <nicolas@fjasle.eu> wrote:
>
> As we still also support make v3.80 to v4.0, please use $(short-opts)
> defined around line 27.

We moved to 4.0 in 5f99665ee8f4 ("kbuild: raise the minimum GNU Make
requirement to 4.0") -- or do you mean something else / am I missing
something?

Thanks!

Cheers,
Miguel
Nicolas Schier Nov. 3, 2024, 11:15 a.m. UTC | #3
On Sat, Nov 02, 2024 at 10:39:07PM +0100 Miguel Ojeda wrote:
> On Sat, Nov 2, 2024 at 10:08 PM Nicolas Schier <nicolas@fjasle.eu> wrote:
> >
> > As we still also support make v3.80 to v4.0, please use $(short-opts)
> > defined around line 27.
> 
> We moved to 4.0 in 5f99665ee8f4 ("kbuild: raise the minimum GNU Make
> requirement to 4.0") -- or do you mean something else / am I missing
> something?

oh yes, thanks. I missed that,

Kind regards
Nicolas
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 44c02a6f60a14..f09c036daf2f5 100644
--- a/Makefile
+++ b/Makefile
@@ -757,6 +757,10 @@  ifdef may-sync-config
 # because some architectures define CROSS_COMPILE there.
 include include/config/auto.conf.cmd
 
+ifeq (,$(findstring B,$(firstword -$(MAKEFLAGS))))
+# This is a dummy target, only meant as a help for the user invoking make.
+# We don't want it to take effect when running 'make --always-make', since
+# that renders the --always-make option effectively useless.
 $(KCONFIG_CONFIG):
 	@echo >&2 '***'
 	@echo >&2 '*** Configuration file "$@" not found!'
@@ -765,6 +769,7 @@  $(KCONFIG_CONFIG):
 	@echo >&2 '*** "make menuconfig" or "make xconfig").'
 	@echo >&2 '***'
 	@/bin/false
+endif
 
 # The actual configuration files used during the build are stored in
 # include/generated/ and include/config/. Update them if .config is newer than