]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - Kbuild
Linux 4.0-rc1
[thirdparty/kernel/linux.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"; \
1cdf25d7
CL
25 echo " */"; \
26 echo ""; \
27 sed -ne $(sed-y) $<; \
28 echo ""; \
29 echo "#endif" ) > $@
30endef
31
39664e2f
MY
32#####
33# 1) Generate bounds.h
34
35bounds-file := include/generated/bounds.h
36
37always := $(bounds-file)
38targets := $(bounds-file) kernel/bounds.s
39
1cdf25d7
CL
40# We use internal kbuild rules to avoid the "is up to date" message from make
41kernel/bounds.s: kernel/bounds.c FORCE
42 $(Q)mkdir -p $(dir $@)
43 $(call if_changed_dep,cc_s_c)
44
45$(obj)/$(bounds-file): kernel/bounds.s Kbuild
46 $(Q)mkdir -p $(dir $@)
39664e2f 47 $(call cmd,offsets,__LINUX_BOUNDS_H__)
1cdf25d7
CL
48
49#####
50# 2) Generate asm-offsets.h
86feeaa8
SR
51#
52
559df2e0 53offsets-file := include/generated/asm-offsets.h
86feeaa8 54
1cdf25d7
CL
55always += $(offsets-file)
56targets += $(offsets-file)
6752ed90 57targets += arch/$(SRCARCH)/kernel/asm-offsets.s
1cdf25d7 58
86feeaa8 59# We use internal kbuild rules to avoid the "is up to date" message from make
1cdf25d7
CL
60arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
61 $(obj)/$(bounds-file) FORCE
86feeaa8
SR
62 $(Q)mkdir -p $(dir $@)
63 $(call if_changed_dep,cc_s_c)
64
6752ed90 65$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
39664e2f 66 $(call cmd,offsets,__ASM_OFFSETS_H__)
86feeaa8 67
c53aeca0 68#####
1cdf25d7 69# 3) Check for missing system calls
c53aeca0
SR
70#
71
5f7efb4c
AL
72always += missing-syscalls
73targets += missing-syscalls
74
c53aeca0 75quiet_cmd_syscalls = CALL $<
44656fa0 76 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
c53aeca0 77
5f7efb4c 78missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
c53aeca0 79 $(call cmd,syscalls)
1cdf25d7 80
ef8ff89b
MM
81# Keep these two files during make clean
82no-clean-files := $(bounds-file) $(offsets-file)