cmake: build man pages

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2016-05-11 21:29:15 +08:00
parent 82af391cea
commit ef6b52373c
5 changed files with 87 additions and 44 deletions

View File

@ -34,6 +34,15 @@ if(WITH_CCACHE)
endif(CCACHE_FOUND)
endif(WITH_CCACHE)
option(WITH_MANPAGE "Build man pages." ON)
if(WITH_MANPAGE)
find_program(SPHINX_BUILD
sphinx-build)
if(NOT SPHINX_BUILD)
message(FATAL_ERROR "Can't find sphinx-build.")
endif(NOT SPHINX_BUILD)
endif(WITH_MANPAGE)
include_directories(
${PROJECT_BINARY_DIR}/src/include
${OFED_PREFIX}/include
@ -363,5 +372,7 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
add_subdirectory(src)
# man pages must be preprocessed, not supported yet
#add_subdirectory(man)
add_subdirectory(doc)
if(WITH_MANPAGE)
add_subdirectory(man)
endif(WITH_MANPAGE)

3
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,3 @@
if(WITH_MANPAGE)
add_subdirectory(man)
endif(WITH_MANPAGE)

53
doc/man/8/CMakeLists.txt Normal file
View File

@ -0,0 +1,53 @@
list(APPEND man_srcs
ceph-osd.rst
ceph-mds.rst
ceph-mon.rst
ceph-syn.rst
crushtool.rst
osdmaptool.rst
monmaptool.rst
ceph-conf.rst
ceph-run.rst
ceph.rst
mount.ceph.rst
ceph-create-keys.rst
radosgw.rst
radosgw-admin.rst
ceph-authtool.rst
rados.rst
librados-config.rst
ceph-clsinfo.rst
ceph-debugpack.rst
cephfs.rst
ceph-dencoder.rst
ceph-rest-api.rst
ceph-post-file.rst)
if(HAVE_LIBFUSE)
list(APPEND man_srcs
ceph-fuse.rst
rbd-fuse.rst)
endif()
if(WITH_RBD)
list(APPEND man_srcs
ceph-rbdnamer.rst
rbd-nbd.rst
rbd-replay-prep.rst
rbd-replay.rst
rbdmap.rst
rbd.rst)
endif()
foreach(man ${man_srcs})
list(APPEND sphinx_input ${CMAKE_CURRENT_SOURCE_DIR}/${man})
# mount.ceph.rst => mount if we use
# get_filename_component(cmd ${man} NAME_WE)
string(REGEX REPLACE ".rst$" "" cmd ${man})
list(APPEND sphinx_output ${sphinx_output_dir}/${cmd}.8)
install(FILES ${sphinx_output_dir}/${cmd}.8
DESTINATION ${CEPH_MAN_DIR}/man8)
endforeach()
set(sphinx_input ${sphinx_input} PARENT_SCOPE)
set(sphinx_output ${sphinx_output} PARENT_SCOPE)

15
doc/man/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
set(sphinx_input)
set(sphinx_output)
set(sphinx_output_dir ${CMAKE_BINARY_DIR}/doc/man)
add_subdirectory(8)
add_custom_command(
OUTPUT ${sphinx_output}
COMMAND ${SPHINX_BUILD} -b man -d ${CMAKE_BINARY_DIR}/doc/doctrees -c ${CMAKE_SOURCE_DIR}/man ${CMAKE_CURRENT_SOURCE_DIR} ${sphinx_output_dir}
DEPENDS ${sphinx_input})
add_custom_target(
manpages ALL
DEPENDS ${sphinx_output}
COMMENT "manpages building")

View File

@ -1,43 +1,4 @@
install(FILES
ceph-osd.8
ceph-mds.8
ceph-mon.8
ceph-syn.8
crushtool.8
osdmaptool.8
monmaptool.8
ceph-conf.8
ceph-run.8
ceph.8
mount.ceph.8
ceph-create-keys.8
radosgw.8
radosgw-admin.8
ceph-authtool.8
rados.8
librados-config.8
ceph-clsinfo.8
ceph-debugpack.8
cephfs.8
ceph-dencoder.8
ceph-rest-api.8
ceph-post-file.8
DESTINATION ${CEPH_MAN_DIR}/man8)
if(HAVE_LIBFUSE)
install(FILES
ceph-fuse.8
rbd-fuse.8
DESTINATION ${CEPH_MAN_DIR}/man8)
endif()
if(WITH_RBD)
install(FILES
ceph-rbdnamer.8
rbd-nbd.8
rbd-replay-prep.8
rbd-replay.8
rbdmap.8
rbd.8
DESTINATION ${CEPH_MAN_DIR}/man8)
if(WITH_SELINUX)
install(FILES ceph_selinux.8
DESTINATION ${CEPH_MAN_DIR}/man8)
endif()