]> git.ipfire.org Git - thirdparty/linux.git/blob - Kbuild
Merge tag 'for-4.21' of git://git.armlinux.org.uk/~rmk/linux-arm
[thirdparty/linux.git] / Kbuild
1 # SPDX-License-Identifier: GPL-2.0
2 #
3 # Kbuild for top-level directory of the kernel
4 # This file takes care of the following:
5 # 1) Generate bounds.h
6 # 2) Generate timeconst.h
7 # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
8 # 4) Check for missing system calls
9 # 5) Generate constants.py (may need bounds.h)
10
11 #####
12 # 1) Generate bounds.h
13
14 bounds-file := include/generated/bounds.h
15
16 always := $(bounds-file)
17 targets := kernel/bounds.s
18
19 $(bounds-file): kernel/bounds.s FORCE
20 $(call filechk,offsets,__LINUX_BOUNDS_H__)
21
22 #####
23 # 2) Generate timeconst.h
24
25 timeconst-file := include/generated/timeconst.h
26
27 targets += $(timeconst-file)
28
29 define filechk_gentimeconst
30 (echo $(CONFIG_HZ) | bc -q $< )
31 endef
32
33 $(timeconst-file): kernel/time/timeconst.bc FORCE
34 $(call filechk,gentimeconst)
35
36 #####
37 # 3) Generate asm-offsets.h
38 #
39
40 offsets-file := include/generated/asm-offsets.h
41
42 always += $(offsets-file)
43 targets += arch/$(SRCARCH)/kernel/asm-offsets.s
44
45 arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
46
47 $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
48 $(call filechk,offsets,__ASM_OFFSETS_H__)
49
50 #####
51 # 4) Check for missing system calls
52 #
53
54 always += missing-syscalls
55 targets += missing-syscalls
56
57 quiet_cmd_syscalls = CALL $<
58 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
59
60 missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
61 $(call cmd,syscalls)
62
63 #####
64 # 5) Generate constants for Python GDB integration
65 #
66
67 extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
68
69 build_constants_py: $(timeconst-file) $(bounds-file)
70 @$(MAKE) $(build)=scripts/gdb/linux $@
71
72 # Keep these three files during make clean
73 no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)