diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2015-01-05 01:57:15 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2015-01-05 04:40:09 -0500 |
commit | 39664e2f3cdef98f42437e903159a6044a1d99d6 (patch) | |
tree | cc3df2b6cf8c5d4c6039a680649d363da11afa76 | |
parent | 34948e0bbf98640fc1821751b01d2f0cd17d84d5 (diff) |
kbuild: merge bounds.h and asm-offsets.h rules
The rules "cmd_bounds" and "cmd_offsets" are almost the same.
(The difference is only the include guards.) They can be merged.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | Kbuild | 60 |
1 files changed, 21 insertions, 39 deletions
@@ -5,19 +5,19 @@ | |||
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 " *"; \ |
@@ -30,6 +30,14 @@ define cmd_bounds | |||
30 | echo "#endif" ) > $@ | 30 | echo "#endif" ) > $@ |
31 | endef | 31 | endef |
32 | 32 | ||
33 | ##### | ||
34 | # 1) Generate bounds.h | ||
35 | |||
36 | bounds-file := include/generated/bounds.h | ||
37 | |||
38 | always := $(bounds-file) | ||
39 | targets := $(bounds-file) kernel/bounds.s | ||
40 | |||
33 | # We use internal kbuild rules to avoid the "is up to date" message from make | 41 | # We use internal kbuild rules to avoid the "is up to date" message from make |
34 | kernel/bounds.s: kernel/bounds.c FORCE | 42 | kernel/bounds.s: kernel/bounds.c FORCE |
35 | $(Q)mkdir -p $(dir $@) | 43 | $(Q)mkdir -p $(dir $@) |
@@ -37,7 +45,7 @@ kernel/bounds.s: kernel/bounds.c FORCE | |||
37 | 45 | ||
38 | $(obj)/$(bounds-file): kernel/bounds.s Kbuild | 46 | $(obj)/$(bounds-file): kernel/bounds.s Kbuild |
39 | $(Q)mkdir -p $(dir $@) | 47 | $(Q)mkdir -p $(dir $@) |
40 | $(call cmd,bounds) | 48 | $(call cmd,offsets,__LINUX_BOUNDS_H__) |
41 | 49 | ||
42 | ##### | 50 | ##### |
43 | # 2) Generate asm-offsets.h | 51 | # 2) Generate asm-offsets.h |
@@ -49,32 +57,6 @@ always += $(offsets-file) | |||
49 | targets += $(offsets-file) | 57 | targets += $(offsets-file) |
50 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s | 58 | targets += arch/$(SRCARCH)/kernel/asm-offsets.s |
51 | 59 | ||
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 | 60 | # 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 \ | 61 | arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ |
80 | $(obj)/$(bounds-file) FORCE | 62 | $(obj)/$(bounds-file) FORCE |
@@ -82,7 +64,7 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ | |||
82 | $(call if_changed_dep,cc_s_c) | 64 | $(call if_changed_dep,cc_s_c) |
83 | 65 | ||
84 | $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild | 66 | $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild |
85 | $(call cmd,offsets) | 67 | $(call cmd,offsets,__ASM_OFFSETS_H__) |
86 | 68 | ||
87 | ##### | 69 | ##### |
88 | # 3) Check for missing system calls | 70 | # 3) Check for missing system calls |