^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # Kbuild for top-level directory of the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #####
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Generate bounds.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) bounds-file := include/generated/bounds.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) always-y := $(bounds-file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) targets := kernel/bounds.s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) $(bounds-file): kernel/bounds.s FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) $(call filechk,offsets,__LINUX_BOUNDS_H__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #####
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) # Generate timeconst.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) timeconst-file := include/generated/timeconst.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) $(timeconst-file): kernel/time/timeconst.bc FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) $(call filechk,gentimeconst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #####
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # Generate asm-offsets.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) offsets-file := include/generated/asm-offsets.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) always-y += $(offsets-file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) targets += arch/$(SRCARCH)/kernel/asm-offsets.s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) $(call filechk,offsets,__ASM_OFFSETS_H__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #####
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) # Check for missing system calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) always-y += missing-syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) quiet_cmd_syscalls = CALL $<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) $(call cmd,syscalls)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #####
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) # Check atomic headers are up-to-date
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) always-y += old-atomics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) quiet_cmd_atomics = CALL $<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) cmd_atomics = $(CONFIG_SHELL) $<
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) old-atomics: scripts/atomic/check-atomics.sh FORCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) $(call cmd,atomics)