treewide: add intermediate .s files to targets
[linux-2.6-block.git] / Kbuild
CommitLineData
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
f197d75f 9# 5) Generate constants.py (may need bounds.h)
86feeaa8 10
39664e2f
MY
11#####
12# 1) Generate bounds.h
13
14bounds-file := include/generated/bounds.h
15
16always := $(bounds-file)
8a58e162 17targets := kernel/bounds.s
39664e2f 18
70a4fd6c
MM
19$(obj)/$(bounds-file): kernel/bounds.s FORCE
20 $(call filechk,offsets,__LINUX_BOUNDS_H__)
1cdf25d7
CL
21
22#####
0a227985
NMG
23# 2) Generate timeconst.h
24
25timeconst-file := include/generated/timeconst.h
26
0a227985
NMG
27targets += $(timeconst-file)
28
29quiet_cmd_gentimeconst = GEN $@
30define cmd_gentimeconst
31 (echo $(CONFIG_HZ) | bc -q $< ) > $@
32endef
33define filechk_gentimeconst
34 (echo $(CONFIG_HZ) | bc -q $< )
35endef
36
37$(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
38 $(call filechk,gentimeconst)
39
40#####
41# 3) Generate asm-offsets.h
86feeaa8
SR
42#
43
559df2e0 44offsets-file := include/generated/asm-offsets.h
86feeaa8 45
1cdf25d7 46always += $(offsets-file)
6752ed90 47targets += arch/$(SRCARCH)/kernel/asm-offsets.s
1cdf25d7 48
4d4b5c2e 49arch/$(SRCARCH)/kernel/asm-offsets.s: $(obj)/$(timeconst-file) $(obj)/$(bounds-file)
86feeaa8 50
70a4fd6c
MM
51$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
52 $(call filechk,offsets,__ASM_OFFSETS_H__)
86feeaa8 53
c53aeca0 54#####
0a227985 55# 4) Check for missing system calls
c53aeca0
SR
56#
57
5f7efb4c
AL
58always += missing-syscalls
59targets += missing-syscalls
60
c53aeca0 61quiet_cmd_syscalls = CALL $<
44656fa0 62 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
c53aeca0 63
5f7efb4c 64missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
c53aeca0 65 $(call cmd,syscalls)
1cdf25d7 66
f197d75f
KB
67#####
68# 5) Generate constants for Python GDB integration
69#
70
71extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py
72
73build_constants_py: $(obj)/$(timeconst-file) $(obj)/$(bounds-file)
74 @$(MAKE) $(build)=scripts/gdb/linux $@
75
0a227985
NMG
76# Keep these three files during make clean
77no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)