1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 286feeaa8SSam Ravnborg# 386feeaa8SSam Ravnborg# Kbuild for top-level directory of the kernel 486feeaa8SSam Ravnborg# This file takes care of the following: 51cdf25d7SChristoph Lameter# 1) Generate bounds.h 60a227985SNicholas Mc Guire# 2) Generate timeconst.h 70a227985SNicholas Mc Guire# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h) 80a227985SNicholas Mc Guire# 4) Check for missing system calls 9f197d75fSKieran Bingham# 5) Generate constants.py (may need bounds.h) 1086feeaa8SSam Ravnborg 1139664e2fSMasahiro Yamada##### 1239664e2fSMasahiro Yamada# 1) Generate bounds.h 1339664e2fSMasahiro Yamada 1439664e2fSMasahiro Yamadabounds-file := include/generated/bounds.h 1539664e2fSMasahiro Yamada 1639664e2fSMasahiro Yamadaalways := $(bounds-file) 178a58e162SMasahiro Yamadatargets := kernel/bounds.s 1839664e2fSMasahiro Yamada 1911fda148SMasahiro Yamada$(bounds-file): kernel/bounds.s FORCE 2070a4fd6cSMichal Marek $(call filechk,offsets,__LINUX_BOUNDS_H__) 2139664e2fSMasahiro Yamada 2239664e2fSMasahiro Yamada##### 230a227985SNicholas Mc Guire# 2) Generate timeconst.h 240a227985SNicholas Mc Guire 250a227985SNicholas Mc Guiretimeconst-file := include/generated/timeconst.h 260a227985SNicholas Mc Guire 270a227985SNicholas Mc Guiretargets += $(timeconst-file) 280a227985SNicholas Mc Guire 29ba97df45SMasahiro Yamadafilechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< 300a227985SNicholas Mc Guire 3111fda148SMasahiro Yamada$(timeconst-file): kernel/time/timeconst.bc FORCE 320a227985SNicholas Mc Guire $(call filechk,gentimeconst) 330a227985SNicholas Mc Guire 340a227985SNicholas Mc Guire##### 350a227985SNicholas Mc Guire# 3) Generate asm-offsets.h 3639664e2fSMasahiro Yamada# 3739664e2fSMasahiro Yamada 3839664e2fSMasahiro Yamadaoffsets-file := include/generated/asm-offsets.h 3939664e2fSMasahiro Yamada 4039664e2fSMasahiro Yamadaalways += $(offsets-file) 4139664e2fSMasahiro Yamadatargets += arch/$(SRCARCH)/kernel/asm-offsets.s 4239664e2fSMasahiro Yamada 4311fda148SMasahiro Yamadaarch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) 4486feeaa8SSam Ravnborg 4511fda148SMasahiro Yamada$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE 4670a4fd6cSMichal Marek $(call filechk,offsets,__ASM_OFFSETS_H__) 4786feeaa8SSam Ravnborg 48c53aeca0SSam Ravnborg##### 490a227985SNicholas Mc Guire# 4) Check for missing system calls 50c53aeca0SSam Ravnborg# 51c53aeca0SSam Ravnborg 525f7efb4cSArnaud Lacombealways += missing-syscalls 535f7efb4cSArnaud Lacombetargets += missing-syscalls 545f7efb4cSArnaud Lacombe 55c53aeca0SSam Ravnborgquiet_cmd_syscalls = CALL $< 5644656fa0SDavid Daney cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) 57c53aeca0SSam Ravnborg 585f7efb4cSArnaud Lacombemissing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE 59c53aeca0SSam Ravnborg $(call cmd,syscalls) 601cdf25d7SChristoph Lameter 61f197d75fSKieran Bingham##### 62f197d75fSKieran Bingham# 5) Generate constants for Python GDB integration 63f197d75fSKieran Bingham# 64f197d75fSKieran Bingham 65f197d75fSKieran Binghamextra-$(CONFIG_GDB_SCRIPTS) += build_constants_py 66f197d75fSKieran Bingham 6711fda148SMasahiro Yamadabuild_constants_py: $(timeconst-file) $(bounds-file) 68f197d75fSKieran Bingham @$(MAKE) $(build)=scripts/gdb/linux $@ 69f197d75fSKieran Bingham 700a227985SNicholas Mc Guire# Keep these three files during make clean 710a227985SNicholas Mc Guireno-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) 72