]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - Kbuild
kbuild: merge bounds.h and asm-offsets.h rules
[mirror_ubuntu-zesty-kernel.git] / Kbuild
CommitLineData
86feeaa8
SR
1#
2# Kbuild for top-level directory of the kernel
3# This file takes care of the following:
1cdf25d7
CL
4# 1) Generate bounds.h
5# 2) Generate asm-offsets.h (may need bounds.h)
6# 3) Check for missing system calls
86feeaa8 7
39664e2f
MY
8# Default sed regexp - multiline due to syntax constraints
9define sed-y
10 "/^->/{s:->#\(.*\):/* \1 */:; \
11 s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
12 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
13 s:->::; p;}"
14endef
1cdf25d7 15
39664e2f
MY
16quiet_cmd_offsets = GEN $@
17define cmd_offsets
1cdf25d7 18 (set -e; \
39664e2f
MY
19 echo "#ifndef $2"; \
20 echo "#define $2"; \
1cdf25d7
CL
21 echo "/*"; \
22 echo " * DO NOT MODIFY."; \
23 echo " *"; \
24 echo " * This file was generated by Kbuild"; \
25 echo " *"; \
26 echo " */"; \
27 echo ""; \
28 sed -ne $(sed-y) $<; \
29 echo ""; \
30 echo "#endif" ) > $@
31endef
32
39664e2f
MY
33#####
34# 1) Generate bounds.h
35
36bounds-file := include/generated/bounds.h
37
38always := $(bounds-file)
39targets := $(bounds-file) kernel/bounds.s
40
1cdf25d7
CL
41# We use internal kbuild rules to avoid the "is up to date" message from make
42kernel/bounds.s: kernel/bounds.c FORCE
43 $(Q)mkdir -p $(dir $@)
44 $(call if_changed_dep,cc_s_c)
45
46$(obj)/$(bounds-file): kernel/bounds.s Kbuild
47 $(Q)mkdir -p $(dir $@)
39664e2f 48 $(call cmd,offsets,__LINUX_BOUNDS_H__)
1cdf25d7
CL
49
50#####
51# 2) Generate asm-offsets.h
86feeaa8
SR
52#
53
559df2e0 54offsets-file := include/generated/asm-offsets.h
86feeaa8 55
1cdf25d7
CL
56always += $(offsets-file)
57targets += $(offsets-file)
6752ed90 58targets += arch/$(SRCARCH)/kernel/asm-offsets.s
1cdf25d7 59
86feeaa8 60# We use internal kbuild rules to avoid the "is up to date" message from make
1cdf25d7
CL
61arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
62 $(obj)/$(bounds-file) FORCE
86feeaa8
SR
63 $(Q)mkdir -p $(dir $@)
64 $(call if_changed_dep,cc_s_c)
65
6752ed90 66$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
39664e2f 67 $(call cmd,offsets,__ASM_OFFSETS_H__)
86feeaa8 68
c53aeca0 69#####
1cdf25d7 70# 3) Check for missing system calls
c53aeca0
SR
71#
72
5f7efb4c
AL
73always += missing-syscalls
74targets += missing-syscalls
75
c53aeca0 76quiet_cmd_syscalls = CALL $<
44656fa0 77 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
c53aeca0 78
5f7efb4c 79missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
c53aeca0 80 $(call cmd,syscalls)
1cdf25d7 81
ef8ff89b
MM
82# Keep these two files during make clean
83no-clean-files := $(bounds-file) $(offsets-file)