Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753438Ab1C1IaU (ORCPT ); Mon, 28 Mar 2011 04:30:20 -0400 Received: from vpn.id2.novell.com ([195.33.99.129]:37101 "EHLO vpn.id2.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755Ab1C1IaP convert rfc822-to-8bit (ORCPT ); Mon, 28 Mar 2011 04:30:15 -0400 Message-Id: <4D90636902000078000389B8@vpn.id2.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Mon, 28 Mar 2011 09:31:05 +0100 From: "Jan Beulich" To: "Lai Jiangshan" Cc: "Ingo Molnar" , "Alexander van Heukelum" , "Dipankar Sarma" , "Peter Zijlstra" , "Andrew Morton" , "H. Peter Anvin" , "Paul E. McKenney" , "Sam Ravnborg" , "David Howells" , "Oleg Nesterov" , "Roland McGrath" , "Christoph Lameter" , "Serge Hallyn" , Subject: Re: [RFC PATCH 2/5] kbuild: dedumplicated the generating code References: <4D8FF8AD.5080607@cn.fujitsu.com> <4D8FF963.6080208@cn.fujitsu.com> In-Reply-To: <4D8FF963.6080208@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4104 Lines: 136 >>> On 28.03.11 at 04:58, Lai Jiangshan wrote: > > cmd_bounds and cmd_offsets are almost the same, dedumplicated them. > The definition of sed-y is also moved up the top of the file. > > Signed-off-by: Lai Jiangshan > --- > Kbuild | 60 +++++++++++++++++++++--------------------------------------- > 1 files changed, 21 insertions(+), 39 deletions(-) > > diff --git a/Kbuild b/Kbuild > index 2114113..5c2ee83 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 */:; \ Having to touch (move) this code would imo be a very good opportunity to simplify it again: The replacement string is the same for those two lines, and the second match expression is a super set of the first one. That is, the first one can be dropped, and hence the whole thing changed back to its pre-3234282f33b29d349bcada40204fc7c8fda7fe72 form. Jan > + s:->::; p;}" > +endef > > -quiet_cmd_bounds = GEN $@ > -define cmd_bounds > +quiet_cmd_kbuild_gen = GEN $@ > +define cmd_kbuild_gen > (set -e; \ > - echo "#ifndef __LINUX_BOUNDS_H__"; \ > - echo "#define __LINUX_BOUNDS_H__"; \ > + echo "#ifndef __$$(echo $@ | tr -- '-./a-z' '___A-Z')__"; \ > + echo "#define __$$(echo $@ | tr -- '-./a-z' '___A-Z')__"; \ > 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,kbuild_gen) > > ##### > # 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,kbuild_gen) > > ##### > # 3) Check for missing system calls > -- > 1.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/