Skip to content

Commit 037fc33

Browse files
committed
kbuild: force all architectures except um to include mandatory-y
Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes the common Kbuild.asm file. Factor out the duplicated include directives to scripts/Makefile.asm-generic so that no architecture would opt out of the mandatory-y mechanism. um is not forced to include mandatory-y since it is a very exceptional case which does not support UAPI. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 7cbbbb8 commit 037fc33

File tree

29 files changed

+18
-47
lines changed

29 files changed

+18
-47
lines changed

Documentation/kbuild/makefiles.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ See subsequent chapter for the syntax of the Kbuild file.
12741274

12751275
--- 7.4 mandatory-y
12761276

1277-
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild.asm
1277+
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
12781278
to define the minimum set of ASM headers that all architectures must have.
12791279

12801280
This works like optional generic-y. If a mandatory header is missing

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,11 @@ asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
10981098

10991099
PHONY += asm-generic uapi-asm-generic
11001100
asm-generic: uapi-asm-generic
1101-
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm
1101+
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm \
1102+
generic=include/asm-generic
11021103
uapi-asm-generic:
1103-
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm
1104+
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
1105+
generic=include/uapi/asm-generic
11041106

11051107
PHONY += prepare-objtool
11061108
prepare-objtool: $(objtool_target)

arch/alpha/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h

arch/arc/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/arm/include/uapi/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
include include/uapi/asm-generic/Kbuild.asm
32

43
generated-y += unistd-common.h
54
generated-y += unistd-oabi.h

arch/arm64/include/uapi/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
include include/uapi/asm-generic/Kbuild.asm
32

43
generic-y += kvm_para.h

arch/c6x/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/csky/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += ucontext.h

arch/h8300/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/hexagon/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += ucontext.h

arch/ia64/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_64.h
42
generic-y += kvm_para.h

arch/m68k/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generic-y += kvm_para.h
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generic-y += kvm_para.h
53
generic-y += ucontext.h

arch/mips/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_n32.h
42
generated-y += unistd_n64.h
53
generated-y += unistd_o32.h

arch/nds32/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += ucontext.h

arch/nios2/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/openrisc/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/parisc/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generated-y += unistd_64.h
53
generic-y += kvm_para.h

arch/powerpc/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generated-y += unistd_64.h

arch/riscv/include/uapi/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
include include/uapi/asm-generic/Kbuild.asm

arch/s390/include/uapi/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
include include/uapi/asm-generic/Kbuild.asm
32

43
generated-y += unistd_32.h
54
generated-y += unistd_64.h

arch/sh/include/uapi/asm/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
include include/uapi/asm-generic/Kbuild.asm
32

43
generated-y += unistd_32.h
54
generic-y += kvm_para.h

arch/sparc/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generated-y += unistd_64.h
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generic-y += kvm_para.h
42
generic-y += ucontext.h

arch/x86/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generated-y += unistd_64.h
53
generated-y += unistd_x32.h

arch/xtensa/include/uapi/asm/Kbuild

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
include include/uapi/asm-generic/Kbuild.asm
2-
31
generated-y += unistd_32.h
42
generic-y += kvm_para.h

include/asm-generic/Kbuild

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# asm headers that all architectures except um should have
4+
# (This file is not included when SRCARCH=um since UML borrows several
5+
# asm headers from the host architecutre.)

include/uapi/asm-generic/Kbuild.asm renamed to include/uapi/asm-generic/Kbuild

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# SPDX-License-Identifier: GPL-2.0
12
#
23
# Headers that are mandatory in usr/include/asm/
3-
#
4+
# (This file is not included when SRCARCH=um since UML does not support UAPI.)
5+
46
mandatory-y += auxvec.h
57
mandatory-y += bitsperlong.h
68
mandatory-y += bpf_perf_event.h

scripts/Makefile.asm-generic

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ all:
1212
src := $(subst /generated,,$(obj))
1313
-include $(src)/Kbuild
1414

15+
# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
16+
ifneq ($(SRCARCH),um)
17+
include $(generic)/Kbuild
18+
endif
19+
1520
include scripts/Kbuild.include
1621

1722
redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))

0 commit comments

Comments
 (0)