From patchwork Thu May 5 02:03:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 755732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4523emH027606 for ; Thu, 5 May 2011 02:03:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752611Ab1EECDo (ORCPT ); Wed, 4 May 2011 22:03:44 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:61982 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752473Ab1EECDo (ORCPT ); Wed, 4 May 2011 22:03:44 -0400 Received: by mail-iw0-f174.google.com with SMTP id 34so1461966iwn.19 for ; Wed, 04 May 2011 19:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=R+KFeL23a3ZNdExABYHG88RdN8ipfwN/AAvoWZb9XE4=; b=hI5QqWsziSOcA2coFewWluMoNrHF9pMUcgMsZhNpr90izi8yXlkoZLj4OFfYXK7jSu oduiDHxpJXPSwDokweRMaduI9tIcFDDtUwrfprMhV+uDPm3LPPbII9Zrf8Mu8TNJ3VZJ TQy1fbCjbUpejsvKLpNe7akRZur5EQ3F81rpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=whZGL1x1nXr39yb68T3l3Sv2BanG6dvcvkMFtuI5yzu7hDRs/y7K2ZLZA1tQ2ozU6s rD6PuiQSDrKT22U4aDrl09AT571mhHUrXxgpW8FNU9/lFxy2xwWU8I9v5Qka49qJg0of 6oS19OKvgWpKVscqpxBgq+JHyRmakI56KCjU8= Received: by 10.43.65.197 with SMTP id xn5mr229575icb.87.1304561023840; Wed, 04 May 2011 19:03:43 -0700 (PDT) Received: from localhost.localdomain (76-10-146-236.dsl.teksavvy.com [76.10.146.236]) by mx.google.com with ESMTPS id gy41sm688054ibb.56.2011.05.04.19.03.41 (version=SSLv3 cipher=OTHER); Wed, 04 May 2011 19:03:42 -0700 (PDT) From: Arnaud Lacombe To: linux-kbuild@vger.kernel.org Cc: Michal Marek , Arnaud Lacombe Subject: [RFC 7/9] kbuild: merge parser generation rules Date: Wed, 4 May 2011 22:03:22 -0400 Message-Id: <1304561004-2684-8-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.3.4.574.g608b.dirty In-Reply-To: <1304561004-2684-1-git-send-email-lacombar@gmail.com> References: <1304561004-2684-1-git-send-email-lacombar@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 05 May 2011 02:03:44 +0000 (UTC) --- scripts/Makefile.lib | 31 ++++++++++++++++++++++++++++++- scripts/genksyms/Makefile | 20 -------------------- scripts/kconfig/Makefile | 25 ------------------------- 3 files changed, 30 insertions(+), 46 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 1c702ca..74a73de 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -160,13 +160,42 @@ ld_flags = $(LDFLAGS) $(ldflags-y) modname-multi = $(sort $(foreach m,$(multi-used),\ $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) +ifdef REGENERATE_PARSERS +# GPERF +# --------------------------------------------------------------------------- +quiet_cmd_gperf = GPERF $@ + cmd_gperf = gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< +$(src)/%.hash.c_shipped: $(src)/%.gperf + $(call cmd,gperf) + +# LEX +# --------------------------------------------------------------------------- +quiet_cmd_flex = LEX $@ + cmd_flex = flex -L -P$(notdir $*) -o$@ $< +$(src)/lex.%.c_shipped: $(src)/%.l + $(call cmd,flex) + +# YACC +# --------------------------------------------------------------------------- +quiet_cmd_bison = YACC $@ + cmd_bison = bison -o$@ -l -b $* -p $(notdir $*) $< +$(src)/%.tab.c_shipped: $(src)/%.y + $(call cmd,bison) +endif + # Shipped files # =========================================================================== quiet_cmd_shipped = SHIPPED $@ cmd_shipped = cat $< > $@ -$(obj)/%:: $(src)/%_shipped +$(obj)/%.tab.c: $(src)/%.tab.c_shipped + $(call cmd,shipped) + +$(obj)/lex.%.c: $(src)/lex.%.c_shipped + $(call cmd,shipped) + +$(obj)/%.hash.c: $(src)/%.hash.c_shipped $(call cmd,shipped) # Commands useful for building a boot image diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile index de6675d..e3295a8 100644 --- a/scripts/genksyms/Makefile +++ b/scripts/genksyms/Makefile @@ -14,23 +14,3 @@ clean-files := genksyms.tab.c lex.genksyms.c genksyms.hash.c $(obj)/genksyms.tab.o: $(obj)/lex.genksyms.c $(obj)/genksyms.hash.c -ifdef GENKSYMS_GENPARSER - -$(obj)/genksyms.tab.c: $(src)/genksyms.y -$(obj)/lex.genksyms.c: $(src)/genksyms.l -$(obj)/genksyms.hash.c: $(src)/genksyms.gperf - -%.tab.c: %.y - bison -l -b $* -p $(notdir $*) $< - cp $@ $@_shipped - -lex.%.c: %.l - flex -L -P$(notdir $*) -o$@ $< - cp $@ $@_shipped - -%.hash.c: %.gperf - gperf -t --output-file $@ -a -C -E -g -k 1,3,$$ -p -t $< - cp $@ $@_shipped - -endif - diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 368ae30..c9ec4d6 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -327,28 +327,3 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h $(obj)/gconf.glade.h: $(obj)/gconf.glade intltool-extract --type=gettext/glade $(obj)/gconf.glade -### -# The following requires flex/bison/gperf -# By default we use the _shipped versions, uncomment the following line if -# you are modifying the flex/bison src. -# LKC_GENPARSER := 1 - -ifdef LKC_GENPARSER - -$(obj)/zconf.tab.c: $(src)/zconf.y -$(obj)/lex.zconf.c: $(src)/zconf.l -$(obj)/zconf.hash.c: $(src)/zconf.gperf - -%.tab.c: %.y - bison -l -b $* -p $(notdir $*) $< - cp $@ $@_shipped - -lex.%.c: %.l - flex -L -P$(notdir $*) -o$@ $< - cp $@ $@_shipped - -%.hash.c: %.gperf - gperf < $< > $@ - cp $@ $@_shipped - -endif