* [PATCH v2 0/2] kbuild: Refactor ./Kbuild
@ 2015-01-05 6:57 Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 1/2] kbuild: merge bounds.h and asm-offsets.h rules Masahiro Yamada
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-01-05 6:57 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
Changes in v2:
- Pass the include guard as an argument of cmd_offsets
as Michal Marek suggested.
Masahiro Yamada (2):
kbuild: merge bounds.h and asm-offsets.h rules
kbuild: remove redundant line from bounds.h/asm-offsets.h
Kbuild | 61 +++++++++++++++++++++----------------------------------------
1 file changed, 21 insertions(+), 40 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] kbuild: merge bounds.h and asm-offsets.h rules
2015-01-05 6:57 [PATCH v2 0/2] kbuild: Refactor ./Kbuild Masahiro Yamada
@ 2015-01-05 6:57 ` Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 2/2] kbuild: remove redundant line from bounds.h/asm-offsets.h Masahiro Yamada
2015-01-05 9:44 ` [PATCH v2 0/2] kbuild: Refactor ./Kbuild Michal Marek
2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-01-05 6:57 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
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>
---
Changes in v2:
- Pass the include guard as an argument of cmd_offsets
as Michal Marek suggested.
Kbuild | 60 +++++++++++++++++++++---------------------------------------
1 file changed, 21 insertions(+), 39 deletions(-)
diff --git a/Kbuild b/Kbuild
index 5d7c729..68febf4 100644
--- a/Kbuild
+++ b/Kbuild
@@ -5,19 +5,19 @@
# 2) Generate asm-offsets.h (may need bounds.h)
# 3) Check for missing system calls
-#####
-# 1) Generate bounds.h
-
-bounds-file := include/generated/bounds.h
-
-always := $(bounds-file)
-targets := $(bounds-file) kernel/bounds.s
+# Default sed regexp - multiline due to syntax constraints
+define sed-y
+ "/^->/{s:->#\(.*\):/* \1 */:; \
+ s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:->::; p;}"
+endef
-quiet_cmd_bounds = GEN $@
-define cmd_bounds
+quiet_cmd_offsets = GEN $@
+define cmd_offsets
(set -e; \
- echo "#ifndef __LINUX_BOUNDS_H__"; \
- echo "#define __LINUX_BOUNDS_H__"; \
+ echo "#ifndef $2"; \
+ echo "#define $2"; \
echo "/*"; \
echo " * DO NOT MODIFY."; \
echo " *"; \
@@ -30,6 +30,14 @@ define cmd_bounds
echo "#endif" ) > $@
endef
+#####
+# 1) Generate bounds.h
+
+bounds-file := include/generated/bounds.h
+
+always := $(bounds-file)
+targets := $(bounds-file) kernel/bounds.s
+
# We use internal kbuild rules to avoid the "is up to date" message from make
kernel/bounds.s: kernel/bounds.c FORCE
$(Q)mkdir -p $(dir $@)
@@ -37,7 +45,7 @@ kernel/bounds.s: kernel/bounds.c FORCE
$(obj)/$(bounds-file): kernel/bounds.s Kbuild
$(Q)mkdir -p $(dir $@)
- $(call cmd,bounds)
+ $(call cmd,offsets,__LINUX_BOUNDS_H__)
#####
# 2) Generate asm-offsets.h
@@ -49,32 +57,6 @@ always += $(offsets-file)
targets += $(offsets-file)
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
-
-# Default sed regexp - multiline due to syntax constraints
-define sed-y
- "/^->/{s:->#\(.*\):/* \1 */:; \
- s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
- s:->::; p;}"
-endef
-
-quiet_cmd_offsets = GEN $@
-define cmd_offsets
- (set -e; \
- echo "#ifndef __ASM_OFFSETS_H__"; \
- echo "#define __ASM_OFFSETS_H__"; \
- echo "/*"; \
- echo " * DO NOT MODIFY."; \
- echo " *"; \
- echo " * This file was generated by Kbuild"; \
- echo " *"; \
- echo " */"; \
- echo ""; \
- sed -ne $(sed-y) $<; \
- echo ""; \
- echo "#endif" ) > $@
-endef
-
# We use internal kbuild rules to avoid the "is up to date" message from make
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
$(obj)/$(bounds-file) FORCE
@@ -82,7 +64,7 @@ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
$(call if_changed_dep,cc_s_c)
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
- $(call cmd,offsets)
+ $(call cmd,offsets,__ASM_OFFSETS_H__)
#####
# 3) Check for missing system calls
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] kbuild: remove redundant line from bounds.h/asm-offsets.h
2015-01-05 6:57 [PATCH v2 0/2] kbuild: Refactor ./Kbuild Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 1/2] kbuild: merge bounds.h and asm-offsets.h rules Masahiro Yamada
@ 2015-01-05 6:57 ` Masahiro Yamada
2015-01-05 9:44 ` [PATCH v2 0/2] kbuild: Refactor ./Kbuild Michal Marek
2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-01-05 6:57 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
This line produces an extra comment line for bounds.h and
asm-offsets.h.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---
Changes in v2: None
Kbuild | 1 -
1 file changed, 1 deletion(-)
diff --git a/Kbuild b/Kbuild
index 68febf4..ef1c627 100644
--- a/Kbuild
+++ b/Kbuild
@@ -22,7 +22,6 @@ define cmd_offsets
echo " * DO NOT MODIFY."; \
echo " *"; \
echo " * This file was generated by Kbuild"; \
- echo " *"; \
echo " */"; \
echo ""; \
sed -ne $(sed-y) $<; \
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] kbuild: Refactor ./Kbuild
2015-01-05 6:57 [PATCH v2 0/2] kbuild: Refactor ./Kbuild Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 1/2] kbuild: merge bounds.h and asm-offsets.h rules Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 2/2] kbuild: remove redundant line from bounds.h/asm-offsets.h Masahiro Yamada
@ 2015-01-05 9:44 ` Michal Marek
2 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2015-01-05 9:44 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild; +Cc: linux-kernel
On 2015-01-05 07:57, Masahiro Yamada wrote:
> Changes in v2:
> - Pass the include guard as an argument of cmd_offsets
> as Michal Marek suggested.
>
> Masahiro Yamada (2):
> kbuild: merge bounds.h and asm-offsets.h rules
> kbuild: remove redundant line from bounds.h/asm-offsets.h
Merged into kbuild.git#kbuild, thanks a lot!
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-05 9:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 6:57 [PATCH v2 0/2] kbuild: Refactor ./Kbuild Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 1/2] kbuild: merge bounds.h and asm-offsets.h rules Masahiro Yamada
2015-01-05 6:57 ` [PATCH v2 2/2] kbuild: remove redundant line from bounds.h/asm-offsets.h Masahiro Yamada
2015-01-05 9:44 ` [PATCH v2 0/2] kbuild: Refactor ./Kbuild Michal Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).