]> git.notmuchmail.org Git - notmuch/commitdiff
doc: Fix parallel build of roff files
authorAustin Clements <amdragon@MIT.EDU>
Thu, 17 Apr 2014 20:34:57 +0000 (16:34 -0400)
committerDavid Bremner <david@tethera.net>
Fri, 18 Apr 2014 20:55:30 +0000 (05:55 +0900)
The roff build rule builds all of the roff files in a single command.
Previously, this was expressed as a multi-target rule, but since this
is equivalent to specifying a copy of the rule for each target, make
-jN could start up to N parallel instances of this command.  Fix this
by bottlenecking this rule through a single stamp file.

This also removes the unused man.stamp from CLEAN.

doc/Makefile.local

index 0980c71c2ac3e0d792025d914b5010d446a7e954..d42079725e908b275460c1020c18bf79ea05bdc3 100644 (file)
@@ -35,7 +35,13 @@ MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})
 
 # Use the man page converter that is available. We should never depend
 # on MAN_ROFF_FILES if a converter is not available.
-${MAN_ROFF_FILES}: ${MAN_RST_FILES}
+${MAN_ROFF_FILES}: $(DOCBUILDDIR)/.roff.stamp
+
+# By using $(DOCBUILDDIR)/.roff.stamp instead of ${MAN_ROFF_FILES}, we
+# convey to make that a single invocation of this recipe builds all
+# of the roff files.  This prevents parallel make from starting an
+# instance of this recipe for each roff file.
+$(DOCBUILDDIR)/.roff.stamp: ${MAN_RST_FILES}
 ifeq ($(HAVE_SPHINX),1)
        $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
        for section in 1 5 7; do \
@@ -48,6 +54,7 @@ else
        @echo "Fatal: build dependency fail."
        @false
 endif
+       touch ${MAN_ROFF_FILES} $@
 
 # Do not try to build or install man pages if a man page converter is
 # not available.
@@ -70,5 +77,5 @@ endif
 $(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py
        $(mkdocdeps) $(srcdir)/doc $(DOCBUILDDIR) $@
 
-CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(dir)/man.stamp
+CLEAN := $(CLEAN) $(DOCBUILDDIR) $(dir)/docdeps.mk $(DOCBUILDDIR)/.roff.stamp
 CLEAN := $(CLEAN) $(MAN_GZIP_FILES) $(MAN_ROFF_FILES)