All of lore.kernel.org
 help / color / mirror / Atom feed
* kbuild: Port build system to the future versions of gnu make.
@ 2024-01-27 22:14 Dmitry Goncharov
  2024-01-28  2:11 ` Miguel Ojeda
  2024-01-28 12:40 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Goncharov @ 2024-01-27 22:14 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Martin Dorey

[-- Attachment #1: Type: text/plain, Size: 3892 bytes --]

Port build system to the future (post make-4.4.1) versions of gnu make.

Starting from https://git.savannah.gnu.org/cgit/make.git/commit/?id=07fcee35f058a876447c8a021f9eb1943f902534
gnu make won't allow conditionals to follow recipe prefix.

For example there is a tab followed by ifeq on line 324 in the root Makefile.
With the new make this conditional causes the following

$ make cpu.o
/home/dgoncharov/src/linux-kbuild/Makefile:2063: *** missing 'endif'.  Stop.
make: *** [Makefile:240: __sub-make] Error 2

See https://savannah.gnu.org/bugs/?64185 and
https://savannah.gnu.org/bugs/?64259 for details.

This patch replaces tabs followed by conditionals with 8 spaces.
In case the mailer program messes up the tabs and spaces in the diff,
i enclosed the same patch in the attachment.

Signed-off-by: Dmitry Goncharov <dgoncharov@users.sf.net>
Reported-by: Martin Dorey <martin.dorey@hitachivantara.com>

regards, Dmitry


diff --git a/Makefile b/Makefile
index 9869f57c3fb3..12dcc51c586a 100644
--- a/Makefile
+++ b/Makefile
@@ -294,15 +294,15 @@ may-sync-config    := 1
 single-build    :=

 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
-    ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
+        ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
         need-config :=
-    endif
+        endif
 endif

 ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
-    ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
+        ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
         may-sync-config :=
-    endif
+        endif
 endif

 need-compiler := $(may-sync-config)
@@ -323,9 +323,9 @@ endif
 # We cannot build single targets and the others at the same time
 ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
     single-build := 1
-    ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
+        ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
         mixed-build := 1
-    endif
+        endif
 endif

 # For "make -j clean all", "make -j mrproper defconfig all", etc.
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 43e39040d3ac..76ef1a67c361 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -15,10 +15,10 @@
 KBUILD_DEFCONFIG := multi_defconfig

 ifdef cross_compiling
-    ifeq ($(CROSS_COMPILE),)
+        ifeq ($(CROSS_COMPILE),)
         CROSS_COMPILE := $(call cc-cross-prefix, \
             m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
-    endif
+        endif
 endif

 #
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 920db57b6b4c..7486b3b30594 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -50,12 +50,12 @@ export CROSS32CC

 # Set default cross compiler for kernel build
 ifdef cross_compiling
-    ifeq ($(CROSS_COMPILE),)
+        ifeq ($(CROSS_COMPILE),)
         CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
         CROSS_COMPILE := $(call cc-cross-prefix, \
             $(foreach a,$(CC_ARCHES), \
             $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
-    endif
+        endif
 endif

 ifdef CONFIG_DYNAMIC_FTRACE
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1a068de12a56..2264db14a25d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -112,13 +112,13 @@ ifeq ($(CONFIG_X86_32),y)
         # temporary until string.h is fixed
         KBUILD_CFLAGS += -ffreestanding

-    ifeq ($(CONFIG_STACKPROTECTOR),y)
-        ifeq ($(CONFIG_SMP),y)
+        ifeq ($(CONFIG_STACKPROTECTOR),y)
+                ifeq ($(CONFIG_SMP),y)
             KBUILD_CFLAGS += -mstack-protector-guard-reg=fs
-mstack-protector-guard-symbol=__stack_chk_guard
-        else
+                else
             KBUILD_CFLAGS += -mstack-protector-guard=global
-        endif
-    endif
+                endif
+        endif
 else
         BITS := 64
         UTS_MACHINE := x86_64

[-- Attachment #2: tabs_and_cond.diff --]
[-- Type: text/x-patch, Size: 2830 bytes --]

diff --git a/Makefile b/Makefile
index 9869f57c3fb3..12dcc51c586a 100644
--- a/Makefile
+++ b/Makefile
@@ -294,15 +294,15 @@ may-sync-config	:= 1
 single-build	:=
 
 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
-	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
+        ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
 		need-config :=
-	endif
+        endif
 endif
 
 ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
-	ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
+        ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
 		may-sync-config :=
-	endif
+        endif
 endif
 
 need-compiler := $(may-sync-config)
@@ -323,9 +323,9 @@ endif
 # We cannot build single targets and the others at the same time
 ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
 	single-build := 1
-	ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
+        ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
 		mixed-build := 1
-	endif
+        endif
 endif
 
 # For "make -j clean all", "make -j mrproper defconfig all", etc.
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 43e39040d3ac..76ef1a67c361 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -15,10 +15,10 @@
 KBUILD_DEFCONFIG := multi_defconfig
 
 ifdef cross_compiling
-	ifeq ($(CROSS_COMPILE),)
+        ifeq ($(CROSS_COMPILE),)
 		CROSS_COMPILE := $(call cc-cross-prefix, \
 			m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
-	endif
+        endif
 endif
 
 #
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 920db57b6b4c..7486b3b30594 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -50,12 +50,12 @@ export CROSS32CC
 
 # Set default cross compiler for kernel build
 ifdef cross_compiling
-	ifeq ($(CROSS_COMPILE),)
+        ifeq ($(CROSS_COMPILE),)
 		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
 		CROSS_COMPILE := $(call cc-cross-prefix, \
 			$(foreach a,$(CC_ARCHES), \
 			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
-	endif
+        endif
 endif
 
 ifdef CONFIG_DYNAMIC_FTRACE
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1a068de12a56..2264db14a25d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -112,13 +112,13 @@ ifeq ($(CONFIG_X86_32),y)
         # temporary until string.h is fixed
         KBUILD_CFLAGS += -ffreestanding
 
-	ifeq ($(CONFIG_STACKPROTECTOR),y)
-		ifeq ($(CONFIG_SMP),y)
+        ifeq ($(CONFIG_STACKPROTECTOR),y)
+                ifeq ($(CONFIG_SMP),y)
 			KBUILD_CFLAGS += -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard
-		else
+                else
 			KBUILD_CFLAGS += -mstack-protector-guard=global
-		endif
-	endif
+                endif
+        endif
 else
         BITS := 64
         UTS_MACHINE := x86_64

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

* Re: kbuild: Port build system to the future versions of gnu make.
  2024-01-27 22:14 kbuild: Port build system to the future versions of gnu make Dmitry Goncharov
@ 2024-01-28  2:11 ` Miguel Ojeda
  2024-01-28 12:40 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-01-28  2:11 UTC (permalink / raw)
  To: Dmitry Goncharov; +Cc: linux-kbuild, Masahiro Yamada, Martin Dorey

On Sat, Jan 27, 2024 at 11:15 PM Dmitry Goncharov
<dgoncharov@users.sf.net> wrote:
>
> Port build system to the future (post make-4.4.1) versions of gnu make.

Thanks for the heads up!

> This patch replaces tabs followed by conditionals with 8 spaces.
> In case the mailer program messes up the tabs and spaces in the diff,
> i enclosed the same patch in the attachment.

Yeah, it is mangled, and the commit message needs some refactoring to
separate the non-commit bits like this paragraph, but the contents in
the attached diff are what I would expect (I did the changes on my
side grepping for `ifeq`/`ifneq`/`else` and they match yours). So for
the contents themselves:

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

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

* Re: kbuild: Port build system to the future versions of gnu make.
  2024-01-27 22:14 kbuild: Port build system to the future versions of gnu make Dmitry Goncharov
  2024-01-28  2:11 ` Miguel Ojeda
@ 2024-01-28 12:40 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-01-28 12:40 UTC (permalink / raw)
  To: Dmitry Goncharov; +Cc: linux-kbuild, Martin Dorey

On Sun, Jan 28, 2024 at 7:14 AM Dmitry Goncharov
<dgoncharov@users.sf.net> wrote:
>
> Port build system to the future (post make-4.4.1) versions of gnu make.
>
> Starting from https://git.savannah.gnu.org/cgit/make.git/commit/?id=07fcee35f058a876447c8a021f9eb1943f902534
> gnu make won't allow conditionals to follow recipe prefix.
>
> For example there is a tab followed by ifeq on line 324 in the root Makefile.
> With the new make this conditional causes the following
>
> $ make cpu.o
> /home/dgoncharov/src/linux-kbuild/Makefile:2063: *** missing 'endif'.  Stop.
> make: *** [Makefile:240: __sub-make] Error 2
>
> See https://savannah.gnu.org/bugs/?64185 and
> https://savannah.gnu.org/bugs/?64259 for details.
>
> This patch replaces tabs followed by conditionals with 8 spaces.
> In case the mailer program messes up the tabs and spaces in the diff,
> i enclosed the same patch in the attachment.
>
> Signed-off-by: Dmitry Goncharov <dgoncharov@users.sf.net>
> Reported-by: Martin Dorey <martin.dorey@hitachivantara.com>
>
> regards, Dmitry


Thanks. Looks good to me.

But, the commit subject
"kbuild: Port build system to the future versions of gnu make"
is ambiguous.


Can you describe what the patch is changing?

For example,
"kbuild: avoid using tabs followed by conditionals for future gnu make"
or something similar.




>
>
> diff --git a/Makefile b/Makefile
> index 9869f57c3fb3..12dcc51c586a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -294,15 +294,15 @@ may-sync-config    := 1
>  single-build    :=
>
>  ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
> -    ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
> +        ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
>          need-config :=
> -    endif
> +        endif
>  endif
>
>  ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
> -    ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
> +        ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
>          may-sync-config :=
> -    endif
> +        endif
>  endif
>
>  need-compiler := $(may-sync-config)
> @@ -323,9 +323,9 @@ endif
>  # We cannot build single targets and the others at the same time
>  ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
>      single-build := 1
> -    ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
> +        ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
>          mixed-build := 1
> -    endif
> +        endif
>  endif
>
>  # For "make -j clean all", "make -j mrproper defconfig all", etc.
> diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
> index 43e39040d3ac..76ef1a67c361 100644
> --- a/arch/m68k/Makefile
> +++ b/arch/m68k/Makefile
> @@ -15,10 +15,10 @@
>  KBUILD_DEFCONFIG := multi_defconfig
>
>  ifdef cross_compiling
> -    ifeq ($(CROSS_COMPILE),)
> +        ifeq ($(CROSS_COMPILE),)
>          CROSS_COMPILE := $(call cc-cross-prefix, \
>              m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
> -    endif
> +        endif
>  endif
>
>  #
> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
> index 920db57b6b4c..7486b3b30594 100644
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
> @@ -50,12 +50,12 @@ export CROSS32CC
>
>  # Set default cross compiler for kernel build
>  ifdef cross_compiling
> -    ifeq ($(CROSS_COMPILE),)
> +        ifeq ($(CROSS_COMPILE),)
>          CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
>          CROSS_COMPILE := $(call cc-cross-prefix, \
>              $(foreach a,$(CC_ARCHES), \
>              $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
> -    endif
> +        endif
>  endif
>
>  ifdef CONFIG_DYNAMIC_FTRACE
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 1a068de12a56..2264db14a25d 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -112,13 +112,13 @@ ifeq ($(CONFIG_X86_32),y)
>          # temporary until string.h is fixed
>          KBUILD_CFLAGS += -ffreestanding
>
> -    ifeq ($(CONFIG_STACKPROTECTOR),y)
> -        ifeq ($(CONFIG_SMP),y)
> +        ifeq ($(CONFIG_STACKPROTECTOR),y)
> +                ifeq ($(CONFIG_SMP),y)
>              KBUILD_CFLAGS += -mstack-protector-guard-reg=fs
> -mstack-protector-guard-symbol=__stack_chk_guard
> -        else
> +                else
>              KBUILD_CFLAGS += -mstack-protector-guard=global
> -        endif
> -    endif
> +                endif
> +        endif
>  else
>          BITS := 64
>          UTS_MACHINE := x86_64



-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2024-01-28 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-27 22:14 kbuild: Port build system to the future versions of gnu make Dmitry Goncharov
2024-01-28  2:11 ` Miguel Ojeda
2024-01-28 12:40 ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.