[PATCH] D149809: [Clang][Docs] Fix man page build
Tom Stellard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 4 03:45:47 PDT 2023
tstellar added a comment.
In D149809#4317763 <https://reviews.llvm.org/D149809#4317763>, @aidengrossman wrote:
> In D149809#4317610 <https://reviews.llvm.org/D149809#4317610>, @tstellar wrote:
>
>> I think we could remove some of the duplication by making the docs_target parameter into a list and passing both docs-clang-html and docs-clang-man to it.
>
> If I'm understanding things correctly we wouldn't be able to do this for either the `gen_docs_depends` or `gen_rst_file_from_td` functions because someone might have the HTML docs build turned on and the man pages build turned off or vice versa. We can only add dependencies to the target after it's created as far as I'm aware.
I tried to explain what I was thinking with the suggested edits. Does that make sense?
================
Comment at: clang/docs/CMakeLists.txt:93
-function (gen_rst_file_from_td output_file td_option source docs_target)
+function (gen_rst_file_from_td output_file td_option source)
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${source}")
----------------
================
Comment at: clang/docs/CMakeLists.txt:99
list(APPEND LLVM_TABLEGEN_FLAGS "-I${TABLEGEN_INCLUDE_DIR}")
clang_tablegen(${output_file} ${td_option} SOURCE ${source} TARGET "gen-${output_file}")
+endfunction()
----------------
================
Comment at: clang/docs/CMakeLists.txt:112
include(AddSphinxTarget)
- if (SPHINX_FOUND)
+ if (SPHINX_FOUND AND (${SPHINX_OUTPUT_HTML} OR ${SPHINX_OUTPUT_MAN}))
+ # Copy rst files to build directory before generating the html
----------------
================
Comment at: clang/docs/CMakeLists.txt:128-131
+ # Generated files
+ gen_rst_file_from_td(AttributeReference.rst -gen-attr-docs ../include/clang/Basic/Attr.td)
+ gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td)
+ gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td)
----------------
================
Comment at: clang/docs/CMakeLists.txt:134
if (${SPHINX_OUTPUT_HTML})
add_sphinx_target(html clang SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
----------------
================
Comment at: clang/docs/CMakeLists.txt:144
if (${SPHINX_OUTPUT_MAN})
- add_sphinx_target(man clang)
+ add_sphinx_target(man clang SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ gen_docs_depends(docs-clang-man)
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149809/new/
https://reviews.llvm.org/D149809
More information about the cfe-commits
mailing list