Kbuild 1.4 KB
Newer Older
1
# SPDX-License-Identifier: GPL-2.0
2 3 4
#
# Kbuild for top-level directory of the kernel
# This file takes care of the following:
5
# 1) Generate bounds.h
6 7 8
# 2) Generate timeconst.h
# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
# 4) Check for missing system calls
9

10 11 12 13 14 15
#####
# 1) Generate bounds.h

bounds-file := include/generated/bounds.h

always  := $(bounds-file)
16
targets := kernel/bounds.s
17

18
$(bounds-file): kernel/bounds.s FORCE
19
	$(call filechk,offsets,__LINUX_BOUNDS_H__)
20 21

#####
22 23 24 25 26 27
# 2) Generate timeconst.h

timeconst-file := include/generated/timeconst.h

targets += $(timeconst-file)

28
filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $<
29

30
$(timeconst-file): kernel/time/timeconst.bc FORCE
31 32 33 34
	$(call filechk,gentimeconst)

#####
# 3) Generate asm-offsets.h
35 36
#

37
offsets-file := include/generated/asm-offsets.h
38

39
always  += $(offsets-file)
40
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
41

42
arch/$(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
#

51 52 53
always += missing-syscalls
targets += missing-syscalls

54
quiet_cmd_syscalls = CALL    $<
55
      cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
56

57
missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
58
	$(call cmd,syscalls)
59

60 61
# Keep these three files during make clean
no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)