diff --git a/llvm/cmake/modules/AddSphinxTarget.cmake b/llvm/cmake/modules/AddSphinxTarget.cmake --- a/llvm/cmake/modules/AddSphinxTarget.cmake +++ b/llvm/cmake/modules/AddSphinxTarget.cmake @@ -38,6 +38,7 @@ -b ${builder} -d "${SPHINX_DOC_TREE_DIR}" -q # Quiet: no output other than errors and warnings. + -t builder-${builder} # tag for builder ${SPHINX_WARNINGS_AS_ERRORS_FLAG} # Treat warnings as errors if requested "${ARG_SOURCE_DIR}" # Source "${SPHINX_BUILD_DIR}" # Output diff --git a/llvm/docs/conf.py b/llvm/docs/conf.py --- a/llvm/docs/conf.py +++ b/llvm/docs/conf.py @@ -28,22 +28,29 @@ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo'] -import sphinx -if sphinx.version_info >= (3, 0): - # This requires 0.5 or later. - extensions.append('recommonmark') -else: - source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = { '.rst': 'restructuredtext', - '.md': 'markdown', } +try: + import recommonmark +except ImportError: + # manpages do not use any .md sources + if not tags.has('builder-man'): + raise +else: + import sphinx + if sphinx.version_info >= (3, 0): + # This requires 0.5 or later. + extensions.append('recommonmark') + else: + source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} + source_suffix['.md'] = 'markdown' + # The encoding of source files. #source_encoding = 'utf-8-sig'