Commit | Line | Data |
---|---|---|
b2441318 | 1 | # SPDX-License-Identifier: GPL-2.0 |
86feeaa8 SR |
2 | # |
3 | # Kbuild for top-level directory of the kernel | |
4 | # This file takes care of the following: | |
1cdf25d7 | 5 | # 1) Generate bounds.h |
0a227985 NMG |
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 | |
8d325880 MR |
9 | # 5) check atomics headers are up-to-date |
10 | # 6) Generate constants.py (may need bounds.h) | |
86feeaa8 | 11 | |
39664e2f MY |
12 | ##### |
13 | # 1) Generate bounds.h | |
14 | ||
15 | bounds-file := include/generated/bounds.h | |
16 | ||
17 | always := $(bounds-file) | |
8a58e162 | 18 | targets := kernel/bounds.s |
39664e2f | 19 | |
11fda148 | 20 | $(bounds-file): kernel/bounds.s FORCE |
70a4fd6c | 21 | $(call filechk,offsets,__LINUX_BOUNDS_H__) |
1cdf25d7 CL |
22 | |
23 | ##### | |
0a227985 NMG |
24 | # 2) Generate timeconst.h |
25 | ||
26 | timeconst-file := include/generated/timeconst.h | |
27 | ||
0a227985 NMG |
28 | targets += $(timeconst-file) |
29 | ||
ba97df45 | 30 | filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< |
0a227985 | 31 | |
11fda148 | 32 | $(timeconst-file): kernel/time/timeconst.bc FORCE |
0a227985 NMG |
33 | $(call filechk,gentimeconst) |
34 | ||
35 | ##### | |
36 | # 3) Generate asm-offsets.h | |
86feeaa8 SR |
37 | # |
38 | ||
559df2e0 | 39 | offsets-file := include/generated/asm-offsets.h |
86feeaa8 | 40 | |
1cdf25d7 | 41 | always += $(offsets-file) |
6752ed90 | 42 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s |
1cdf25d7 | 43 | |
11fda148 | 44 | arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) |
86feeaa8 | 45 | |
11fda148 | 46 | $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE |
70a4fd6c | 47 | $(call filechk,offsets,__ASM_OFFSETS_H__) |
86feeaa8 | 48 | |
c53aeca0 | 49 | ##### |
0a227985 | 50 | # 4) Check for missing system calls |
c53aeca0 SR |
51 | # |
52 | ||
5f7efb4c AL |
53 | always += missing-syscalls |
54 | targets += missing-syscalls | |
55 | ||
c53aeca0 | 56 | quiet_cmd_syscalls = CALL $< |
44656fa0 | 57 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) |
c53aeca0 | 58 | |
5f7efb4c | 59 | missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE |
c53aeca0 | 60 | $(call cmd,syscalls) |
1cdf25d7 | 61 | |
f197d75f | 62 | ##### |
8d325880 MR |
63 | # 5) Check atomic headers are up-to-date |
64 | # | |
65 | ||
66 | always += old-atomics | |
67 | targets += old-atomics | |
68 | ||
69 | quiet_cmd_atomics = CALL $< | |
bdf37b4d | 70 | cmd_atomics = $(CONFIG_SHELL) $< |
8d325880 MR |
71 | |
72 | old-atomics: scripts/atomic/check-atomics.sh FORCE | |
73 | $(call cmd,atomics) | |
74 | ||
75 | ##### | |
76 | # 6) Generate constants for Python GDB integration | |
f197d75f KB |
77 | # |
78 | ||
79 | extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py | |
80 | ||
11fda148 | 81 | build_constants_py: $(timeconst-file) $(bounds-file) |
f197d75f KB |
82 | @$(MAKE) $(build)=scripts/gdb/linux $@ |
83 | ||
0a227985 NMG |
84 | # Keep these three files during make clean |
85 | no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) |