package cdbs
tags 505328 +patch
thanks

Attached is a patch that gets the number of parallel jobs, and adds support 
for parallel building in the makefile, autotools, qmake,  permodule and cmake 
classes.

PS: why do all these classes override the default DEB_MAKE_INVOKE? This had me 
wondering why it didn't work for a while.

PPS: I don't think the make invocation should have a +, because if the 
configure stage creates stuff that the makefile needs for running, calling 
debian/rules -n doesn't work anymore (which is the case in cdbs itself).


Saludos,
Felipe Sateler
Index: 1/class/cmake.mk.in
===================================================================
--- 1/class/cmake.mk.in	(revision 387)
+++ 1/class/cmake.mk.in	(working copy)
@@ -34,7 +34,7 @@
 
 # Overriden from makefile-vars.mk
 # We pass CFLAGS and friends to cmake, so no need to pass them to make
-DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR)
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR) $(DEB_MAKE_PARALLEL)
 
 DEB_MAKE_INSTALL_TARGET = install DESTDIR=$(DEB_DESTDIR)
 
Index: 1/class/perlmodule-vars.mk.in
===================================================================
--- 1/class/perlmodule-vars.mk.in	(revision 387)
+++ 1/class/perlmodule-vars.mk.in	(working copy)
@@ -26,7 +26,7 @@
 include $(_cdbs_class_path)/makefile-vars.mk$(_cdbs_makefile_suffix)
 
 # Override optimizations to follow Perl Policy 3.3
-DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR) OPTIMIZE="$(CFLAGS)"
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR) OPTIMIZE="$(CFLAGS)" $(DEB_MAKE_PARALLEL)
 
 # Install into first listed package by default.
 # Unset for standard debhelper rules (use debian/tmp if multiple packages).
Index: 1/class/makefile-vars.mk.in
===================================================================
--- 1/class/makefile-vars.mk.in	(revision 387)
+++ 1/class/makefile-vars.mk.in	(working copy)
@@ -27,7 +27,8 @@
 
 DEB_MAKE_MAKEFILE =
 DEB_MAKE_ENVVARS = 
-DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) $(if $(DEB_MAKE_MAKEFILE), -f $(DEB_MAKE_MAKEFILE),) -C $(DEB_BUILDDIR) CFLAGS="$(or $(CFLAGS_$(cdbs_curpkg)),$(CFLAGS))" CXXFLAGS="$(or $(CXXFLAGS_$(cdbs_curpkg)),$(CXXFLAGS))" CPPFLAGS="$(or $(CPPFLAGS_$(cdbs_curpkg)),$(CPPFLAGS))" LDFLAGS="$(or $(LDFLAGS_$(cdbs_curpkg)),$(LDFLAGS))"
+DEB_MAKE_PARALLEL = $(if $(DEB_ENABLE_PARALLEL_BUILD),-j$(DEB_PARALLEL_JOBS))
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) $(if $(DEB_MAKE_MAKEFILE), -f $(DEB_MAKE_MAKEFILE),) -C $(DEB_BUILDDIR) CFLAGS="$(or $(CFLAGS_$(cdbs_curpkg)),$(CFLAGS))" CXXFLAGS="$(or $(CXXFLAGS_$(cdbs_curpkg)),$(CXXFLAGS))" CPPFLAGS="$(or $(CPPFLAGS_$(cdbs_curpkg)),$(CPPFLAGS))" LDFLAGS="$(or $(LDFLAGS_$(cdbs_curpkg)),$(LDFLAGS))" $(DEB_MAKE_PARALLEL)
 
 # This variable is deprecated.
 DEB_BUILD_MAKE_TARGET = 
Index: 1/class/autotools.mk.in
===================================================================
--- 1/class/autotools.mk.in	(revision 387)
+++ 1/class/autotools.mk.in	(working copy)
@@ -26,7 +26,7 @@
 
 # Overriden from makefile-vars.mk.  We pass CFLAGS and friends to ./configure, so
 # no need to pass them to make.
-DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR)
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR) $(DEB_MAKE_PARALLEL)
 
 common-configure-arch common-configure-indep:: common-configure-impl
 common-configure-impl:: $(DEB_BUILDDIR)/config.status
Index: 1/class/langcore.mk.in
===================================================================
--- 1/class/langcore.mk.in	(revision 387)
+++ 1/class/langcore.mk.in	(working copy)
@@ -32,4 +32,17 @@
 CFLAGS += $(DEB_OPT_FLAG)
 CXXFLAGS += $(DEB_OPT_FLAG)
 
+# Enable parallel building
+ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
+	DEB_PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
+	  sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
+else
+	DEB_PARALLEL_JOBS := 1
 endif
+
+# Make sure it is a number
+ifneq ($(shell echo $(DEB_PARALLEL_JOBS) | grep '^[[:digit:]]\+'),$(DEB_PARALLEL_JOBS))
+	DEB_PARALLEL_JOBS := 1
+endif
+
+endif
Index: 1/class/qmake.mk.in
===================================================================
--- 1/class/qmake.mk.in	(revision 387)
+++ 1/class/qmake.mk.in	(working copy)
@@ -24,7 +24,7 @@
 
 include $(_cdbs_class_path)/makefile.mk$(_cdbs_makefile_suffix)
 
-DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR)
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) $(MAKE) -C $(DEB_BUILDDIR) $(DEB_MAKE_PARALLEL)
 
 DEB_MAKE_INSTALL_TARGET = install INSTALL_ROOT=$(DEB_DESTDIR)
 DEB_MAKE_CLEAN_TARGET = distclean

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to