# 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 \
@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.
$(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)