Hi Linus, On Fri, Feb 2, 2024 at 5:06 AM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > On Thu, 1 Feb 2024 at 05:40, Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote: > > > > - Replace tabs with spaces when followed by conditionals for > > future GNU Make versions > > This is horrid. > > Now, the whole "whitespace type matters" is broken in Make anyway, so > clearly this is a fundamental make problem, but this commit makes > things worse by making the tab replacement use eight spaces, so it > really visually is entirely indistinguishable. > > Don't make a 'make' problem worse by not visually distinguishing tabs > from spaces. > > IOW, those "that can't be a tab" cases should have used pretty much > _anything_ but 8 spaces. Yes on indentation of nested 'if' statements, > but no on then using something that visually makes no sense. > > IOW, those nested if-statements should use perhaps just 2-4 spaces > instead. That tends to match what we sometimes see in C files too, and > it is visually very clearly not a tab with the kernel coding rules > (yes, yes, some people set tabstops to smaller values, that's _their_ > problem). > > I've pulled this, but please fix it, and don't make an insane Makefile > whitespace situation worse. > > Linus Personally, I find 4 spaces more comfortable than 2, as the increased indentation enhances readability. When we have a build rule inside an if-block, we cannot indent the code. In such cases, we can add a comment after the closing 'endif' if it helps improve the readability, just like we often do for preprocessor conditionals in C files. So, the best consistency we can achieve is a combination of "4-space indentation" and "no indentation at all". I attached a patch to replace tab/8-space indentation. Probably, there are still unconverted conditionals, but I fixed all the code blocks touched by commit 82175d1f9430. Is this your expectation? -- Best Regards Masahiro Yamada
From 4bd029eff6e0a88d72e05cc0a962af23b735fef8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada <masahiroy@xxxxxxxxxx> Date: Fri, 2 Feb 2024 06:23:44 +0900 Subject: [PATCH] Makefile: replace tab/8-space indentation with 4-space indentation We cannot use tab-indentation in nested if-blocks for the reason described in commit 82175d1f9430 ("kbuild: Replace tabs with spaces when followed by conditionals"). Technically, only tabs followed by conditionals matter, but it is not a good idea to mix tab indentation and 8-space indentation within the same if-block. Linus suggested 2 or 4 spaces for nested if-blocks. [1] This commit replaces a tab with 4 spaces in if-blocks including unnested ones. Otherwise, someone may accidentally append a conditional after a tab. Also, 8 spaces, which cannot be visually distinguished, should be replaced with 4 spaces. [1]: https://lore.kernel.org/all/CAHk-=whJKZNZWsa-VNDKafS_VfY4a5dAjG-r8BZgWk_a-xSepw@xxxxxxxxxxxxxx/ Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx> --- Makefile | 84 ++++++++++---------- arch/m68k/Makefile | 8 +- arch/mips/Makefile | 4 +- arch/openrisc/Makefile | 16 ++-- arch/parisc/Makefile | 20 ++--- arch/powerpc/Makefile | 8 +- arch/riscv/Makefile | 56 +++++++------- arch/sparc/Makefile | 4 +- arch/um/Makefile | 4 +- arch/x86/Makefile | 136 ++++++++++++++++----------------- tools/scripts/Makefile.arch | 12 +-- tools/scripts/Makefile.include | 64 ++++++++-------- 12 files changed, 208 insertions(+), 208 deletions(-) diff --git a/Makefile b/Makefile index 113f7c762f0a..f2bd75b07ddf 100644 --- a/Makefile +++ b/Makefile @@ -245,17 +245,17 @@ else # need-sub-make # We process the rest of the Makefile if this is the final invocation of make ifeq ($(abs_srctree),$(abs_objtree)) - # building in the source tree - srctree := . - building_out_of_srctree := + # building in the source tree + srctree := . + building_out_of_srctree := else - ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) - # building in a subdirectory of the source tree - srctree := .. - else - srctree := $(abs_srctree) - endif - building_out_of_srctree := 1 + ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) + # building in a subdirectory of the source tree + srctree := .. + else + srctree := $(abs_srctree) + endif + building_out_of_srctree := 1 endif ifneq ($(KBUILD_ABS_SRCTREE),) @@ -294,52 +294,52 @@ may-sync-config := 1 single-build := ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) - ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) - need-config := - endif + ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) + need-config := + endif endif ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) - ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) - may-sync-config := - endif + ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) + may-sync-config := + endif endif need-compiler := $(may-sync-config) ifneq ($(KBUILD_EXTMOD),) - may-sync-config := + may-sync-config := endif ifeq ($(KBUILD_EXTMOD),) - ifneq ($(filter %config,$(MAKECMDGOALS)),) - config-build := 1 - ifneq ($(words $(MAKECMDGOALS)),1) - mixed-build := 1 - endif + ifneq ($(filter %config,$(MAKECMDGOALS)),) + config-build := 1 + ifneq ($(words $(MAKECMDGOALS)),1) + mixed-build := 1 endif + endif 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)),) - mixed-build := 1 - endif + single-build := 1 + ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),) + mixed-build := 1 + endif endif # For "make -j clean all", "make -j mrproper defconfig all", etc. ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),) - ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) - mixed-build := 1 - endif + ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) + mixed-build := 1 + endif endif # install and modules_install need also be processed one by one ifneq ($(filter install,$(MAKECMDGOALS)),) - ifneq ($(filter modules_install,$(MAKECMDGOALS)),) - mixed-build := 1 - endif + ifneq ($(filter modules_install,$(MAKECMDGOALS)),) + mixed-build := 1 + endif endif ifdef mixed-build @@ -395,23 +395,23 @@ SRCARCH := $(ARCH) # Additional ARCH settings for x86 ifeq ($(ARCH),i386) - SRCARCH := x86 + SRCARCH := x86 endif ifeq ($(ARCH),x86_64) - SRCARCH := x86 + SRCARCH := x86 endif # Additional ARCH settings for sparc ifeq ($(ARCH),sparc32) - SRCARCH := sparc + SRCARCH := sparc endif ifeq ($(ARCH),sparc64) - SRCARCH := sparc + SRCARCH := sparc endif # Additional ARCH settings for parisc ifeq ($(ARCH),parisc64) - SRCARCH := parisc + SRCARCH := parisc endif export cross_compiling := @@ -580,15 +580,15 @@ KBUILD_LDFLAGS := CLANG_FLAGS := ifeq ($(KBUILD_CLIPPY),1) - RUSTC_OR_CLIPPY_QUIET := CLIPPY - RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) + RUSTC_OR_CLIPPY_QUIET := CLIPPY + RUSTC_OR_CLIPPY = $(CLIPPY_DRIVER) else - RUSTC_OR_CLIPPY_QUIET := RUSTC - RUSTC_OR_CLIPPY = $(RUSTC) + RUSTC_OR_CLIPPY_QUIET := RUSTC + RUSTC_OR_CLIPPY = $(RUSTC) endif ifdef RUST_LIB_SRC - export RUST_LIB_SRC + export RUST_LIB_SRC endif # Allows the usage of unstable features in stable compilers. diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile index 76ef1a67c361..21fb2ee78e69 100644 --- a/arch/m68k/Makefile +++ b/arch/m68k/Makefile @@ -15,10 +15,10 @@ KBUILD_DEFCONFIG := multi_defconfig ifdef cross_compiling - ifeq ($(CROSS_COMPILE),) - CROSS_COMPILE := $(call cc-cross-prefix, \ - m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) - endif + ifeq ($(CROSS_COMPILE),) + CROSS_COMPILE := $(call cc-cross-prefix, \ + m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) + endif endif # diff --git a/arch/mips/Makefile b/arch/mips/Makefile index f49807e1f19b..409c4c44626e 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -317,9 +317,9 @@ endif # remove the upper 32 bits then, as it is safe to do so with other # linkers. ifdef CONFIG_64BIT - load-ld = $(load-y) + load-ld = $(load-y) else - load-ld = $(subst 0xffffffff,0x,$(load-y)) + load-ld = $(subst 0xffffffff,0x,$(load-y)) endif KBUILD_AFLAGS += $(cflags-y) diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile index 68249521db5a..027f9e77ff6c 100644 --- a/arch/openrisc/Makefile +++ b/arch/openrisc/Makefile @@ -28,31 +28,31 @@ all: vmlinux.bin boot := arch/$(ARCH)/boot ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y) - KBUILD_CFLAGS += $(call cc-option,-mhard-mul) + KBUILD_CFLAGS += $(call cc-option,-mhard-mul) else - KBUILD_CFLAGS += $(call cc-option,-msoft-mul) + KBUILD_CFLAGS += $(call cc-option,-msoft-mul) endif ifeq ($(CONFIG_OPENRISC_HAVE_INST_DIV),y) - KBUILD_CFLAGS += $(call cc-option,-mhard-div) + KBUILD_CFLAGS += $(call cc-option,-mhard-div) else - KBUILD_CFLAGS += $(call cc-option,-msoft-div) + KBUILD_CFLAGS += $(call cc-option,-msoft-div) endif ifeq ($(CONFIG_OPENRISC_HAVE_INST_CMOV),y) - KBUILD_CFLAGS += $(call cc-option,-mcmov) + KBUILD_CFLAGS += $(call cc-option,-mcmov) endif ifeq ($(CONFIG_OPENRISC_HAVE_INST_ROR),y) - KBUILD_CFLAGS += $(call cc-option,-mror) + KBUILD_CFLAGS += $(call cc-option,-mror) endif ifeq ($(CONFIG_OPENRISC_HAVE_INST_RORI),y) - KBUILD_CFLAGS += $(call cc-option,-mrori) + KBUILD_CFLAGS += $(call cc-option,-mrori) endif ifeq ($(CONFIG_OPENRISC_HAVE_INST_SEXT),y) - KBUILD_CFLAGS += $(call cc-option,-msext) + KBUILD_CFLAGS += $(call cc-option,-msext) endif libs-y += $(LIBGCC) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 7486b3b30594..70e7f8ce16ef 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -30,11 +30,11 @@ endif # select defconfig based on actual architecture ifeq ($(ARCH),parisc64) - KBUILD_DEFCONFIG := generic-64bit_defconfig - CC_ARCHES := hppa64 + KBUILD_DEFCONFIG := generic-64bit_defconfig + CC_ARCHES := hppa64 else - KBUILD_DEFCONFIG := generic-32bit_defconfig - CC_ARCHES := hppa hppa2.0 hppa1.1 + KBUILD_DEFCONFIG := generic-32bit_defconfig + CC_ARCHES := hppa hppa2.0 hppa1.1 endif export LD_BFD @@ -50,12 +50,12 @@ export CROSS32CC # Set default cross compiler for kernel build ifdef cross_compiling - 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 + 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 ifdef CONFIG_DYNAMIC_FTRACE diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 051247027da0..ef171bf5a1b1 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -43,9 +43,9 @@ endif export BITS ifdef CONFIG_PPC64 - BITS := 64 + BITS := 64 else - BITS := 32 + BITS := 32 endif machine-y = ppc @@ -186,8 +186,8 @@ CHECKFLAGS += -D__LITTLE_ENDIAN__ endif ifdef CONFIG_476FPE_ERR46 - KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ - -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds + KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ + -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds endif # No prefix or pcrel diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 0b7d109258e7..16acad5f66c2 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -8,17 +8,17 @@ LDFLAGS_vmlinux := -z norelro ifeq ($(CONFIG_RELOCATABLE),y) - LDFLAGS_vmlinux += -shared -Bsymbolic -z notext --emit-relocs - KBUILD_CFLAGS += -fPIE + LDFLAGS_vmlinux += -shared -Bsymbolic -z notext --emit-relocs + KBUILD_CFLAGS += -fPIE endif ifeq ($(CONFIG_DYNAMIC_FTRACE),y) - LDFLAGS_vmlinux += --no-relax - KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY -ifeq ($(CONFIG_RISCV_ISA_C),y) - CC_FLAGS_FTRACE := -fpatchable-function-entry=4 -else - CC_FLAGS_FTRACE := -fpatchable-function-entry=2 -endif + LDFLAGS_vmlinux += --no-relax + KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY + ifeq ($(CONFIG_RISCV_ISA_C),y) + CC_FLAGS_FTRACE := -fpatchable-function-entry=4 + else + CC_FLAGS_FTRACE := -fpatchable-function-entry=2 + endif endif ifeq ($(CONFIG_CMODEL_MEDLOW),y) @@ -27,33 +27,33 @@ endif export BITS ifeq ($(CONFIG_ARCH_RV64I),y) - BITS := 64 - UTS_MACHINE := riscv64 + BITS := 64 + UTS_MACHINE := riscv64 - KBUILD_CFLAGS += -mabi=lp64 - KBUILD_AFLAGS += -mabi=lp64 + KBUILD_CFLAGS += -mabi=lp64 + KBUILD_AFLAGS += -mabi=lp64 - KBUILD_LDFLAGS += -melf64lriscv + KBUILD_LDFLAGS += -melf64lriscv else - BITS := 32 - UTS_MACHINE := riscv32 + BITS := 32 + UTS_MACHINE := riscv32 - KBUILD_CFLAGS += -mabi=ilp32 - KBUILD_AFLAGS += -mabi=ilp32 - KBUILD_LDFLAGS += -melf32lriscv + KBUILD_CFLAGS += -mabi=ilp32 + KBUILD_AFLAGS += -mabi=ilp32 + KBUILD_LDFLAGS += -melf32lriscv endif ifndef CONFIG_RISCV_USE_LINKER_RELAXATION - KBUILD_CFLAGS += -mno-relax - KBUILD_AFLAGS += -mno-relax -ifndef CONFIG_AS_IS_LLVM - KBUILD_CFLAGS += -Wa,-mno-relax - KBUILD_AFLAGS += -Wa,-mno-relax -endif + KBUILD_CFLAGS += -mno-relax + KBUILD_AFLAGS += -mno-relax + ifndef CONFIG_AS_IS_LLVM + KBUILD_CFLAGS += -Wa,-mno-relax + KBUILD_AFLAGS += -Wa,-mno-relax + endif endif ifeq ($(CONFIG_SHADOW_CALL_STACK),y) - KBUILD_LDFLAGS += --no-relax-gp + KBUILD_LDFLAGS += --no-relax-gp endif # ISA string setting @@ -83,10 +83,10 @@ KBUILD_CFLAGS += -mno-save-restore KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET) ifeq ($(CONFIG_CMODEL_MEDLOW),y) - KBUILD_CFLAGS += -mcmodel=medlow + KBUILD_CFLAGS += -mcmodel=medlow endif ifeq ($(CONFIG_CMODEL_MEDANY),y) - KBUILD_CFLAGS += -mcmodel=medany + KBUILD_CFLAGS += -mcmodel=medany endif # Avoid generating .eh_frame sections. diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 5f6035936131..8bc4c9449a27 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -10,9 +10,9 @@ # We are not yet configured - so test on arch ifeq ($(ARCH),sparc64) - KBUILD_DEFCONFIG := sparc64_defconfig + KBUILD_DEFCONFIG := sparc64_defconfig else - KBUILD_DEFCONFIG := sparc32_defconfig + KBUILD_DEFCONFIG := sparc32_defconfig endif ifeq ($(CONFIG_SPARC32),y) diff --git a/arch/um/Makefile b/arch/um/Makefile index 34957dcb88b9..bc48647901d2 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -27,11 +27,11 @@ MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas HEADER_ARCH := $(SUBARCH) ifneq ($(filter $(SUBARCH),x86 x86_64 i386),) - HEADER_ARCH := x86 + HEADER_ARCH := x86 endif ifdef CONFIG_64BIT - KBUILD_CFLAGS += -mcmodel=large + KBUILD_CFLAGS += -mcmodel=large endif HOST_DIR := arch/$(HEADER_ARCH) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 2264db14a25d..c9c34fe9c899 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -87,87 +87,87 @@ KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) endif ifeq ($(CONFIG_X86_32),y) - BITS := 32 - UTS_MACHINE := i386 - CHECKFLAGS += -D__i386__ + BITS := 32 + UTS_MACHINE := i386 + CHECKFLAGS += -D__i386__ - KBUILD_AFLAGS += -m32 - KBUILD_CFLAGS += -m32 + KBUILD_AFLAGS += -m32 + KBUILD_CFLAGS += -m32 - KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return + KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return - # Never want PIC in a 32-bit kernel, prevent breakage with GCC built - # with nonstandard options - KBUILD_CFLAGS += -fno-pic + # Never want PIC in a 32-bit kernel, prevent breakage with GCC built + # with nonstandard options + KBUILD_CFLAGS += -fno-pic - # Align the stack to the register width instead of using the default - # alignment of 16 bytes. This reduces stack usage and the number of - # alignment instructions. - KBUILD_CFLAGS += $(cc_stack_align4) + # Align the stack to the register width instead of using the default + # alignment of 16 bytes. This reduces stack usage and the number of + # alignment instructions. + KBUILD_CFLAGS += $(cc_stack_align4) - # CPU-specific tuning. Anything which can be shared with UML should go here. - include $(srctree)/arch/x86/Makefile_32.cpu - KBUILD_CFLAGS += $(cflags-y) + # CPU-specific tuning. Anything which can be shared with UML should go here. + include $(srctree)/arch/x86/Makefile_32.cpu + KBUILD_CFLAGS += $(cflags-y) - # temporary until string.h is fixed - KBUILD_CFLAGS += -ffreestanding + # temporary until string.h is fixed + KBUILD_CFLAGS += -ffreestanding - ifeq ($(CONFIG_STACKPROTECTOR),y) - ifeq ($(CONFIG_SMP),y) - KBUILD_CFLAGS += -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard - else - KBUILD_CFLAGS += -mstack-protector-guard=global - endif + ifeq ($(CONFIG_STACKPROTECTOR),y) + ifeq ($(CONFIG_SMP),y) + KBUILD_CFLAGS += -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard + else + KBUILD_CFLAGS += -mstack-protector-guard=global endif + endif else - BITS := 64 - UTS_MACHINE := x86_64 - CHECKFLAGS += -D__x86_64__ + BITS := 64 + UTS_MACHINE := x86_64 + CHECKFLAGS += -D__x86_64__ - KBUILD_AFLAGS += -m64 - KBUILD_CFLAGS += -m64 + KBUILD_AFLAGS += -m64 + KBUILD_CFLAGS += -m64 - # Align jump targets to 1 byte, not the default 16 bytes: - KBUILD_CFLAGS += $(call cc-option,-falign-jumps=1) + # Align jump targets to 1 byte, not the default 16 bytes: + KBUILD_CFLAGS += $(call cc-option,-falign-jumps=1) - # Pack loops tightly as well: - KBUILD_CFLAGS += $(call cc-option,-falign-loops=1) + # Pack loops tightly as well: + KBUILD_CFLAGS += $(call cc-option,-falign-loops=1) - # Don't autogenerate traditional x87 instructions - KBUILD_CFLAGS += -mno-80387 - KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) + # Don't autogenerate traditional x87 instructions + KBUILD_CFLAGS += -mno-80387 + KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) - # By default gcc and clang use a stack alignment of 16 bytes for x86. - # However the standard kernel entry on x86-64 leaves the stack on an - # 8-byte boundary. If the compiler isn't informed about the actual - # alignment it will generate extra alignment instructions for the - # default alignment which keep the stack *mis*aligned. - # Furthermore an alignment to the register width reduces stack usage - # and the number of alignment instructions. - KBUILD_CFLAGS += $(cc_stack_align8) + # By default gcc and clang use a stack alignment of 16 bytes for x86. + # However the standard kernel entry on x86-64 leaves the stack on an + # 8-byte boundary. If the compiler isn't informed about the actual + # alignment it will generate extra alignment instructions for the + # default alignment which keep the stack *mis*aligned. + # Furthermore an alignment to the register width reduces stack usage + # and the number of alignment instructions. + KBUILD_CFLAGS += $(cc_stack_align8) - # Use -mskip-rax-setup if supported. - KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) + # Use -mskip-rax-setup if supported. + KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) - # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) - cflags-$(CONFIG_MK8) += -march=k8 - cflags-$(CONFIG_MPSC) += -march=nocona - cflags-$(CONFIG_MCORE2) += -march=core2 - cflags-$(CONFIG_MATOM) += -march=atom - cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic - KBUILD_CFLAGS += $(cflags-y) + # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) + cflags-$(CONFIG_MK8) += -march=k8 + cflags-$(CONFIG_MPSC) += -march=nocona + cflags-$(CONFIG_MCORE2) += -march=core2 + cflags-$(CONFIG_MATOM) += -march=atom + cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic + KBUILD_CFLAGS += $(cflags-y) - rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8 - rustflags-$(CONFIG_MPSC) += -Ctarget-cpu=nocona - rustflags-$(CONFIG_MCORE2) += -Ctarget-cpu=core2 - rustflags-$(CONFIG_MATOM) += -Ctarget-cpu=atom - rustflags-$(CONFIG_GENERIC_CPU) += -Ztune-cpu=generic - KBUILD_RUSTFLAGS += $(rustflags-y) + rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8 + rustflags-$(CONFIG_MPSC) += -Ctarget-cpu=nocona + rustflags-$(CONFIG_MCORE2) += -Ctarget-cpu=core2 + rustflags-$(CONFIG_MATOM) += -Ctarget-cpu=atom + rustflags-$(CONFIG_GENERIC_CPU) += -Ztune-cpu=generic + KBUILD_RUSTFLAGS += $(rustflags-y) - KBUILD_CFLAGS += -mno-red-zone - KBUILD_CFLAGS += -mcmodel=kernel - KBUILD_RUSTFLAGS += -Cno-redzone=y - KBUILD_RUSTFLAGS += -Ccode-model=kernel + KBUILD_CFLAGS += -mno-red-zone + KBUILD_CFLAGS += -mcmodel=kernel + KBUILD_RUSTFLAGS += -Cno-redzone=y + KBUILD_RUSTFLAGS += -Ccode-model=kernel endif # @@ -176,14 +176,14 @@ endif # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109) # ifdef CONFIG_FUNCTION_GRAPH_TRACER - ifndef CONFIG_HAVE_FENTRY - ACCUMULATE_OUTGOING_ARGS := 1 - endif + ifndef CONFIG_HAVE_FENTRY + ACCUMULATE_OUTGOING_ARGS := 1 + endif endif ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) - # This compiler flag is not supported by Clang: - KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) + # This compiler flag is not supported by Clang: + KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) endif # Workaround for a gcc prelease that unfortunately was shipped in a suse release diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch index f6a50f06dfc4..bfab64a76dc9 100644 --- a/tools/scripts/Makefile.arch +++ b/tools/scripts/Makefile.arch @@ -15,27 +15,27 @@ SRCARCH := $(ARCH) # Additional ARCH settings for x86 ifeq ($(ARCH),i386) - SRCARCH := x86 + SRCARCH := x86 endif ifeq ($(ARCH),x86_64) - SRCARCH := x86 + SRCARCH := x86 endif # Additional ARCH settings for sparc ifeq ($(ARCH),sparc32) - SRCARCH := sparc + SRCARCH := sparc endif ifeq ($(ARCH),sparc64) - SRCARCH := sparc + SRCARCH := sparc endif # Additional ARCH settings for loongarch ifeq ($(ARCH),loongarch32) - SRCARCH := loongarch + SRCARCH := loongarch endif ifeq ($(ARCH),loongarch64) - SRCARCH := loongarch + SRCARCH := loongarch endif LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 6fba29f3222d..2f46fe6831f3 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -1,14 +1,14 @@ # SPDX-License-Identifier: GPL-2.0 ifneq ($(O),) -ifeq ($(origin O), command line) - dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) - ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd) - OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) - COMMAND_O := O=$(ABSOLUTE_O) -ifeq ($(objtree),) - objtree := $(O) -endif -endif + ifeq ($(origin O), command line) + dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) + ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd) + OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) + COMMAND_O := O=$(ABSOLUTE_O) + ifeq ($(objtree),) + objtree := $(O) + endif + endif endif # check that the output directory actually exists @@ -161,31 +161,31 @@ QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir QUIET_SUBDIR1 = ifneq ($(silent),1) - ifneq ($(V),1) - QUIET_CC = @echo ' CC '$@; - QUIET_CC_FPIC = @echo ' CC FPIC '$@; - QUIET_CLANG = @echo ' CLANG '$@; - QUIET_AR = @echo ' AR '$@; - QUIET_LINK = @echo ' LINK '$@; - QUIET_MKDIR = @echo ' MKDIR '$@; - QUIET_GEN = @echo ' GEN '$@; - QUIET_SUBDIR0 = +@subdir= - QUIET_SUBDIR1 = ;$(NO_SUBDIR) \ - echo ' SUBDIR '$$subdir; \ - $(MAKE) $(PRINT_DIR) -C $$subdir - QUIET_FLEX = @echo ' FLEX '$@; - QUIET_BISON = @echo ' BISON '$@; - QUIET_GENSKEL = @echo ' GENSKEL '$@; + ifneq ($(V),1) + QUIET_CC = @echo ' CC '$@; + QUIET_CC_FPIC = @echo ' CC FPIC '$@; + QUIET_CLANG = @echo ' CLANG '$@; + QUIET_AR = @echo ' AR '$@; + QUIET_LINK = @echo ' LINK '$@; + QUIET_MKDIR = @echo ' MKDIR '$@; + QUIET_GEN = @echo ' GEN '$@; + QUIET_SUBDIR0 = +@subdir= + QUIET_SUBDIR1 = ;$(NO_SUBDIR) \ + echo ' SUBDIR '$$subdir; \ + $(MAKE) $(PRINT_DIR) -C $$subdir + QUIET_FLEX = @echo ' FLEX '$@; + QUIET_BISON = @echo ' BISON '$@; + QUIET_GENSKEL = @echo ' GENSKEL '$@; - descend = \ - +@echo ' DESCEND '$(1); \ - mkdir -p $(OUTPUT)$(1) && \ - $(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2) + descend = \ + +@echo ' DESCEND '$(1); \ + mkdir -p $(OUTPUT)$(1) && \ + $(MAKE) $(COMMAND_O) subdir=$(if $(subdir),$(subdir)/$(1),$(1)) $(PRINT_DIR) -C $(1) $(2) - QUIET_CLEAN = @printf ' CLEAN %s\n' $1; - QUIET_INSTALL = @printf ' INSTALL %s\n' $1; - QUIET_UNINST = @printf ' UNINST %s\n' $1; - endif + QUIET_CLEAN = @printf ' CLEAN %s\n' $1; + QUIET_INSTALL = @printf ' INSTALL %s\n' $1; + QUIET_UNINST = @printf ' UNINST %s\n' $1; + endif endif pound := \# -- 2.40.1