diff --git a/Documentation/automake.mk b/Documentation/automake.mk index ea3475f3567..2a590b3a79a 100644 --- a/Documentation/automake.mk +++ b/Documentation/automake.mk @@ -216,8 +216,13 @@ install-man-rst: docs-check $(extract_stem_and_section); \ echo " $(MKDIR_P) '$(DESTDIR)'\"$$mandir\""; \ $(MKDIR_P) '$(DESTDIR)'"$$mandir"; \ - echo " $(INSTALL_DATA) $(SPHINXBUILDDIR)/man/$$stem.$$section '$(DESTDIR)'\"$$mandir/$$stem.$$section\""; \ - $(INSTALL_DATA) $(SPHINXBUILDDIR)/man/$$stem.$$section '$(DESTDIR)'"$$mandir/$$stem.$$section"; \ + if test -f $(SPHINXBUILDDIR)/man/$$stem.$$section; then \ + filepath=$(SPHINXBUILDDIR)/man/$$stem.$$section; \ + else \ + filepath=$(SPHINXBUILDDIR)/man/$$section/$$stem.$$section; \ + fi; \ + echo " $(INSTALL_DATA) $$filepath '$(DESTDIR)'\"$$mandir/$$stem.$$section\""; \ + $(INSTALL_DATA) $$filepath '$(DESTDIR)'"$$mandir/$$stem.$$section"; \ done else install-man-rst: