aboutsummaryrefslogtreecommitdiffstats
path: root/Kbuild
diff options
context:
space:
mode:
Diffstat (limited to 'Kbuild')
-rw-r--r--Kbuild61
1 files changed, 21 insertions, 40 deletions
diff --git a/Kbuild b/Kbuild
index b8b708ad6dc3..ab8ded92e870 100644
--- a/Kbuild
+++ b/Kbuild
@@ -5,24 +5,23 @@
5# 2) Generate asm-offsets.h (may need bounds.h) 5# 2) Generate asm-offsets.h (may need bounds.h)
6# 3) Check for missing system calls 6# 3) Check for missing system calls
7 7
8##### 8# Default sed regexp - multiline due to syntax constraints
9# 1) Generate bounds.h 9define sed-y
10 10 "/^->/{s:->#\(.*\):/* \1 */:; \
11bounds-file := include/generated/bounds.h 11 s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
12 12 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
13always := $(bounds-file) 13 s:->::; p;}"
14targets := $(bounds-file) kernel/bounds.s 14endef
15 15
16quiet_cmd_bounds = GEN $@ 16quiet_cmd_offsets = GEN $@
17define cmd_bounds 17define cmd_offsets
18 (set -e; \ 18 (set -e; \
19 echo "#ifndef __LINUX_BOUNDS_H__"; \ 19 echo "#ifndef $2"; \
20 echo "#define __LINUX_BOUNDS_H__"; \ 20 echo "#define $2"; \
21 echo "/*"; \ 21 echo "/*"; \
22 echo " * DO NOT MODIFY."; \ 22 echo " * DO NOT MODIFY."; \
23 echo " *"; \ 23 echo " *"; \
24 echo " * This file was generated by Kbuild"; \ 24 echo " * This file was generated by Kbuild"; \
25 echo " *"; \
26 echo " */"; \ 25 echo " */"; \
27 echo ""; \ 26 echo ""; \
28 sed -ne $(sed-y) $<; \ 27 sed -ne $(sed-y) $<; \
@@ -30,6 +29,14 @@ define cmd_bounds
30 echo "#endif" ) > $@ 29 echo "#endif" ) > $@
31endef 30endef
32 31
32#####
33# 1) Generate bounds.h
34
35bounds-file := include/generated/bounds.h
36
37always := $(bounds-file)
38targets := $(bounds-file) kernel/bounds.s
39
33# We use internal kbuild rules to avoid the "is up to date" message from make 40# We use internal kbuild rules to avoid the "is up to date" message from make
34kernel/bounds.s: kernel/bounds.c FORCE 41kernel/bounds.s: kernel/bounds.c FORCE
35 $(Q)mkdir -p $(dir $@) 42 $(Q)mkdir -p $(dir $@)
@@ -37,7 +44,7 @@ kernel/bounds.s: kernel/bounds.c FORCE
37 44
38$(obj)/$(bounds-file): kernel/bounds.s Kbuild 45$(obj)/$(bounds-file): kernel/bounds.s Kbuild
39 $(Q)mkdir -p $(dir $@) 46 $(Q)mkdir -p $(dir $@)
40 $(call cmd,bounds) 47 $(call cmd,offsets,__LINUX_BOUNDS_H__)
41 48
42##### 49#####
43# 2) Generate asm-offsets.h 50# 2) Generate asm-offsets.h
@@ -49,32 +56,6 @@ always += $(offsets-file)
49targets += $(offsets-file) 56targets += $(offsets-file)
50targets += arch/$(SRCARCH)/kernel/asm-offsets.s 57targets += arch/$(SRCARCH)/kernel/asm-offsets.s
51 58
52
53# Default sed regexp - multiline due to syntax constraints
54define sed-y
55 "/^->/{s:->#\(.*\):/* \1 */:; \
56 s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
57 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
58 s:->::; p;}"
59endef
60
61quiet_cmd_offsets = GEN $@
62define cmd_offsets
63 (set -e; \
64 echo "#ifndef __ASM_OFFSETS_H__"; \
65 echo "#define __ASM_OFFSETS_H__"; \
66 echo "/*"; \
67 echo " * DO NOT MODIFY."; \
68 echo " *"; \
69 echo " * This file was generated by Kbuild"; \
70 echo " *"; \
71 echo " */"; \
72 echo ""; \
73 sed -ne $(sed-y) $<; \
74 echo ""; \
75 echo "#endif" ) > $@
76endef
77
78# We use internal kbuild rules to avoid the "is up to date" message from make 59# We use internal kbuild rules to avoid the "is up to date" message from make
79arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ 60arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
80 $(obj)/$(bounds-file) FORCE 61 $(obj)/$(bounds-file) FORCE
@@ -82,7 +63,7 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
82 $(call if_changed_dep,cc_s_c) 63 $(call if_changed_dep,cc_s_c)
83 64
84$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild 65$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
85 $(call cmd,offsets) 66 $(call cmd,offsets,__ASM_OFFSETS_H__)
86 67
87##### 68#####
88# 3) Check for missing system calls 69# 3) Check for missing system calls