From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] include: parallelize compat/xlat.h generation Date: Fri, 28 Feb 2014 17:06:32 +0000 Message-ID: <5310C218.7050300@gmail.com> References: <5310CE9C02000078001204D7@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5671846392851891603==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WJQtS-0006Mp-Hk for xen-devel@lists.xenproject.org; Fri, 28 Feb 2014 17:06:38 +0000 Received: by mail-wi0-f182.google.com with SMTP id f8so861780wiw.9 for ; Fri, 28 Feb 2014 09:06:36 -0800 (PST) In-Reply-To: <5310CE9C02000078001204D7@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============5671846392851891603== Content-Type: multipart/alternative; boundary="------------040205090203030809060406" This is a multi-part message in MIME format. --------------040205090203030809060406 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Jan Beulich wrote: > > Splitting this up into pieces signficantly speeds up building on multi- > CPU systems when making use of make's -j option. > > Signed-off-by: Jan Beulich Yes, very welcome! Acked-by: Keir Fraser > > --- a/xen/include/Makefile > +++ b/xen/include/Makefile > @@ -66,14 +66,24 @@ compat/%.c: public/%.h xlat.lst Makefile > $(PYTHON) $(BASEDIR)/tools/compat-build-source.py>$@.new > mv -f $@.new $@ > > -compat/xlat.h: xlat.lst $(filter-out compat/xlat.h,$(headers-y)) > $(BASEDIR)/tools/get-fields.sh Makefile > +compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst > $(BASEDIR)/tools/get-fields.sh Makefile > export PYTHON=$(PYTHON); \ > - grep -v '^[ ]*#' xlat.lst | \ > - while read what name hdr; do \ > - hdr="compat/$$(echo $$hdr | sed 's,@arch@,$(compat-arch-y),g')"; \ > - echo '$(headers-y)' | grep -q "$$hdr" || continue; \ > - $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $$hdr > || exit $$?; \ > - done>$@.new > + while read what name; do \ > + $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || > exit $$?; \ > + done<$(patsubst compat/%,compat/.xlat/%,$(basename $<)).lst>$@.new > + mv -f $@.new $@ > + > +.PRECIOUS: compat/.xlat/%.lst > +compat/.xlat/%.lst: xlat.lst Makefile > + mkdir -p $(@D) > + grep -v '^[ \t]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -e > 's,[ \t]\+$*\.h[ \t]*$$,,p'>$@.new > + $(call move-if-changed,$@.new,$@) > + > +xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -e 's,^[?!][ > \t]\+[^ \t]\+[ \t]\+,,p' xlat.lst | uniq) > +xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) > + > +compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) Makefile > + cat $(filter %.h,$^)>$@.new > mv -f $@.new $@ > > ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) > > --------------040205090203030809060406 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Jan Beulich wrote:

Splitting this up into pieces signficantly speeds up building on multi-
CPU systems when making use of make's -j option.

Signed-off-by: Jan Beulich<jbeulich@suse.com>


Yes, very welcome!

Acked-by: Keir Fraser <keir@xen.org>


--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -66,14 +66,24 @@ compat/%.c: public/%.h xlat.lst Makefile
  $(PYTHON) $(BASEDIR)/tools/compat-build-source.py>$@.new
  mv -f $@.new $@

-compat/xlat.h: xlat.lst $(filter-out compat/xlat.h,$(headers-y)) $(BASEDIR)/tools/get-fields.sh Makefile
+compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile
  export PYTHON=$(PYTHON); \
- grep -v '^[ ]*#' xlat.lst | \
- while read what name hdr; do \
- hdr="compat/$$(echo $$hdr | sed 's,@arch@,$(compat-arch-y),g')"; \
- echo '$(headers-y)' | grep -q "$$hdr" || continue; \
- $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $$hdr || exit $$?; \
- done>$@.new
+ while read what name; do \
+ $(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $<  || exit $$?; \
+ done<$(patsubst compat/%,compat/.xlat/%,$(basename $<)).lst>$@.new
+ mv -f $@.new $@
+
+.PRECIOUS: compat/.xlat/%.lst
+compat/.xlat/%.lst: xlat.lst Makefile
+ mkdir -p $(@D)
+ grep -v '^[ \t]*#' $<  | sed -ne 's,@arch@,$(compat-arch-y),g' -e 's,[ \t]\+$*\.h[ \t]*$$,,p'>$@.new
+ $(call move-if-changed,$@.new,$@)
+
+xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -e 's,^[?!][ \t]\+[^ \t]\+[ \t]\+,,p' xlat.lst | uniq)
+xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
+
+compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) Makefile
+ cat $(filter %.h,$^)>$@.new
  mv -f $@.new $@

  ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))


--------------040205090203030809060406-- --===============5671846392851891603== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============5671846392851891603==--