aboutsummaryrefslogtreecommitdiffstats
path: root/Kbuild
diff options
context:
space:
mode:
authorMasahiro Yamada2015-01-05 00:57:15 -0600
committerMichal Marek2015-01-05 03:40:09 -0600
commit39664e2f3cdef98f42437e903159a6044a1d99d6 (patch)
treecc3df2b6cf8c5d4c6039a680649d363da11afa76 /Kbuild
parent34948e0bbf98640fc1821751b01d2f0cd17d84d5 (diff)
downloadkernel-39664e2f3cdef98f42437e903159a6044a1d99d6.tar.gz
kernel-39664e2f3cdef98f42437e903159a6044a1d99d6.tar.xz
kernel-39664e2f3cdef98f42437e903159a6044a1d99d6.zip
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>
Diffstat (limited to 'Kbuild')
-rw-r--r--Kbuild60
1 files changed, 21 insertions, 39 deletions
diff --git a/Kbuild b/Kbuild
index b8b708ad6dc3..3ec73e9c6a68 100644
--- a/Kbuild
+++ b/Kbuild
@@ -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 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 " *"; \
@@ -30,6 +30,14 @@ define cmd_bounds
30 echo "#endif" ) > $@ 30 echo "#endif" ) > $@
31endef 31endef
32 32
33#####
34# 1) Generate bounds.h
35
36bounds-file := include/generated/bounds.h
37
38always := $(bounds-file)
39targets := $(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
34kernel/bounds.s: kernel/bounds.c FORCE 42kernel/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)
49targets += $(offsets-file) 57targets += $(offsets-file)
50targets += arch/$(SRCARCH)/kernel/asm-offsets.s 58targets += arch/$(SRCARCH)/kernel/asm-offsets.s
51 59
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 60# 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 \ 61arch/$(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