diff mbox series

[06/36] debian: enable parallel make

Message ID 155259746044.31886.13633380455067163247.stgit@magnolia (mailing list archive)
State Accepted, archived
Headers show
Series xfsprogs-5.0: fix various problems | expand

Commit Message

Darrick J. Wong March 14, 2019, 9:04 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Use parallel make to speed up dpkg builds.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 debian/rules |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Nathan Scott March 15, 2019, 12:18 a.m. UTC | #1
On Fri, Mar 15, 2019 at 8:04 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Use parallel make to speed up dpkg builds.

Seems a little more involved than I woulda expected, but LGTM.

Reviewed-by: Nathan Scott <nathans@debian.org>

>                 for dir in include libxfs; do \
> -                       $(MAKE) -C $$dir NODEP=1 install-headers; \
> +                       $(MAKE) $(PMAKEFLAGS) -C $$dir NODEP=1 install-headers; \
>                 done; \

OOC, does the $(MAKE) -C above warrant the same treatment as the earlier patch?
(i.e. removing the -C there for less verbosity)

cheers.

--
Nathan
Darrick J. Wong March 15, 2019, 1:01 a.m. UTC | #2
On Fri, Mar 15, 2019 at 11:18:32AM +1100, Nathan Scott wrote:
> On Fri, Mar 15, 2019 at 8:04 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Use parallel make to speed up dpkg builds.
> 
> Seems a little more involved than I woulda expected, but LGTM.
> 
> Reviewed-by: Nathan Scott <nathans@debian.org>
> 
> >                 for dir in include libxfs; do \
> > -                       $(MAKE) -C $$dir NODEP=1 install-headers; \
> > +                       $(MAKE) $(PMAKEFLAGS) -C $$dir NODEP=1 install-headers; \
> >                 done; \
> 
> OOC, does the $(MAKE) -C above warrant the same treatment as the earlier patch?
> (i.e. removing the -C there for less verbosity)

Hmm, that seems like it could be the case.  I'll have a look tomorrow.

--D

> cheers.
> 
> --
> Nathan
Darrick J. Wong March 15, 2019, 5:30 a.m. UTC | #3
On Thu, Mar 14, 2019 at 06:01:13PM -0700, Darrick J. Wong wrote:
> On Fri, Mar 15, 2019 at 11:18:32AM +1100, Nathan Scott wrote:
> > On Fri, Mar 15, 2019 at 8:04 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> > >
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > >
> > > Use parallel make to speed up dpkg builds.
> > 
> > Seems a little more involved than I woulda expected, but LGTM.
> > 
> > Reviewed-by: Nathan Scott <nathans@debian.org>
> > 
> > >                 for dir in include libxfs; do \
> > > -                       $(MAKE) -C $$dir NODEP=1 install-headers; \
> > > +                       $(MAKE) $(PMAKEFLAGS) -C $$dir NODEP=1 install-headers; \
> > >                 done; \
> > 
> > OOC, does the $(MAKE) -C above warrant the same treatment as the earlier patch?
> > (i.e. removing the -C there for less verbosity)
> 
> Hmm, that seems like it could be the case.  I'll have a look tomorrow.

It doesn't work, because buildrules sets up $(SUBDIRS) as (phony)
targets so that you can do:

$ make scrub

and have the top level Makefile set Q and then recurse into scrub/
instead of doing it yourself ("make -C scrub").  That's why the previous
-C removal patch works.

The hunk of Makefile you're talking about does:

$ make -C include install-headers

which is different because install-headers is a target that only exists
in {include,libxfs}/Makefile, not the top level build system.  So we
have to get make to chdir into include/ for the target to work at all.

--D

> --D
> 
> > cheers.
> > 
> > --
> > Nathan
diff mbox series

Patch

diff --git a/debian/rules b/debian/rules
index 7c2a8b3c..e8509fb3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,11 @@ 
 
 export DH_VERBOSE=1
 
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    PMAKEFLAGS += -j$(NUMJOBS)
+endif
+
 package = xfsprogs
 develop = xfslibs-dev
 bootpkg = xfsprogs-udeb
@@ -30,7 +35,7 @@  build-arch: built
 build-indep: built
 built: dibuild config
 	@echo "== dpkg-buildpackage: build" 1>&2
-	$(MAKE) default
+	$(MAKE) $(PMAKEFLAGS) default
 	touch built
 
 config: .census
@@ -38,7 +43,7 @@  config: .census
 	@echo "== dpkg-buildpackage: configure" 1>&2
 	$(checkdir)
 	AUTOHEADER=/bin/true dh_autoreconf
-	$(options) $(MAKE) include/platform_defs.h
+	$(options) $(MAKE) $(PMAKEFLAGS) include/platform_defs.h
 	touch .census
 
 dibuild:
@@ -48,10 +53,10 @@  dibuild:
 		$(diopts) $(MAKE) include/platform_defs.h; \
 		mkdir -p include/xfs; \
 		for dir in include libxfs; do \
-			$(MAKE) -C $$dir NODEP=1 install-headers; \
+			$(MAKE) $(PMAKEFLAGS) -C $$dir NODEP=1 install-headers; \
 		done; \
 		for dir in include libxfs libxcmd libfrog mkfs; do \
-			$(MAKE) $$dir; \
+			$(MAKE) $(PMAKEFLAGS) $$dir; \
 		done; \
 		mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \
 		$(MAKE) distclean; \