xref: /openbmc/linux/Kbuild (revision 67274c08)
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
10#####
11# 1) Generate bounds.h
12
13bounds-file := include/generated/bounds.h
14
15always  := $(bounds-file)
16targets := kernel/bounds.s
17
18$(bounds-file): kernel/bounds.s FORCE
19	$(call filechk,offsets,__LINUX_BOUNDS_H__)
20
21#####
22# 2) Generate timeconst.h
23
24timeconst-file := include/generated/timeconst.h
25
26targets += $(timeconst-file)
27
28filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
29
30$(timeconst-file): kernel/time/timeconst.bc FORCE
31	$(call filechk,gentimeconst)
32
33#####
34# 3) Generate asm-offsets.h
35#
36
37offsets-file := include/generated/asm-offsets.h
38
39always  += $(offsets-file)
40targets += arch/$(SRCARCH)/kernel/asm-offsets.s
41
42arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
43
44$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
45	$(call filechk,offsets,__ASM_OFFSETS_H__)
46
47#####
48# 4) Check for missing system calls
49#
50
51always += missing-syscalls
52targets += missing-syscalls
53
54quiet_cmd_syscalls = CALL    $<
55      cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
56
57missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
58	$(call cmd,syscalls)
59
60# Keep these three files during make clean
61no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)
62