From 39664e2f3cdef98f42437e903159a6044a1d99d6 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 5 Jan 2015 15:57:15 +0900 Subject: [PATCH] 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 Signed-off-by: Michal Marek --- Kbuild | 78 ++++++++++++++++++++++------------------------------------ 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/Kbuild b/Kbuild index b8b708ad6dc3..3ec73e9c6a68 100644 --- a/Kbuild +++ b/Kbuild @@ -5,51 +5,6 @@ # 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 - -quiet_cmd_bounds = GEN $@ -define cmd_bounds - (set -e; \ - echo "#ifndef __LINUX_BOUNDS_H__"; \ - echo "#define __LINUX_BOUNDS_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 -kernel/bounds.s: kernel/bounds.c FORCE - $(Q)mkdir -p $(dir $@) - $(call if_changed_dep,cc_s_c) - -$(obj)/$(bounds-file): kernel/bounds.s Kbuild - $(Q)mkdir -p $(dir $@) - $(call cmd,bounds) - -##### -# 2) Generate asm-offsets.h -# - -offsets-file := include/generated/asm-offsets.h - -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 */:; \ @@ -61,8 +16,8 @@ endef quiet_cmd_offsets = GEN $@ define cmd_offsets (set -e; \ - echo "#ifndef __ASM_OFFSETS_H__"; \ - echo "#define __ASM_OFFSETS_H__"; \ + echo "#ifndef $2"; \ + echo "#define $2"; \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \ @@ -75,6 +30,33 @@ define cmd_offsets 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 $@) + $(call if_changed_dep,cc_s_c) + +$(obj)/$(bounds-file): kernel/bounds.s Kbuild + $(Q)mkdir -p $(dir $@) + $(call cmd,offsets,__LINUX_BOUNDS_H__) + +##### +# 2) Generate asm-offsets.h +# + +offsets-file := include/generated/asm-offsets.h + +always += $(offsets-file) +targets += $(offsets-file) +targets += arch/$(SRCARCH)/kernel/asm-offsets.s + # 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