diff options
Diffstat (limited to 'Kbuild')
-rw-r--r-- | Kbuild | 61 |
1 files changed, 21 insertions, 40 deletions
@@ -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 | 9 | define sed-y |
10 | 10 | "/^->/{s:->#\(.*\):/* \1 */:; \ | |
11 | bounds-file := include/generated/bounds.h | 11 | s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ |
12 | 12 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | |
13 | always := $(bounds-file) | 13 | s:->::; p;}" |
14 | targets := $(bounds-file) kernel/bounds.s | 14 | endef |
15 | 15 | ||
16 | quiet_cmd_bounds = GEN $@ | 16 | quiet_cmd_offsets = GEN $@ |
17 | define cmd_bounds | 17 | define 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" ) > $@ |
31 | endef | 30 | endef |
32 | 31 | ||
32 | ##### | ||
33 | # 1) Generate bounds.h | ||
34 | |||
35 | bounds-file := include/generated/bounds.h | ||
36 | |||
37 | always := $(bounds-file) | ||
38 | targets := $(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 |
34 | kernel/bounds.s: kernel/bounds.c FORCE | 41 | kernel/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) | |||
49 | targets += $(offsets-file) | 56 | targets += $(offsets-file) |
50 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s | 57 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s |
51 | 58 | ||
52 | |||
53 | # Default sed regexp - multiline due to syntax constraints | ||
54 | define sed-y | ||
55 | "/^->/{s:->#\(.*\):/* \1 */:; \ | ||
56 | s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
57 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
58 | s:->::; p;}" | ||
59 | endef | ||
60 | |||
61 | quiet_cmd_offsets = GEN $@ | ||
62 | define 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" ) > $@ | ||
76 | endef | ||
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 |
79 | arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ | 60 | arch/$(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 |