]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
include: parallelize compat/xlat.h generation
authorJan Beulich <jbeulich@suse.com>
Tue, 4 Mar 2014 10:03:13 +0000 (11:03 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 4 Mar 2014 10:03:13 +0000 (11:03 +0100)
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>
Acked-by: Keir Fraser <keir@xen.org>
xen/include/Makefile

index 5f2bcf747eff6faff6e7059e31839ad7c1c0a95a..d6f0cf7f576d2ce907e7d1a206d4508ed2c19b2b 100644 (file)
@@ -66,14 +66,24 @@ compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py
        $(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))