[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH] include: parallelize compat/xlat.h generation
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@xxxxxxxx>
Yes, very welcome!
Acked-by: Keir Fraser <keir@xxxxxxx>
--- 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))
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|