cmake: make manpages have dependecies again

This commit is contained in:
Michael Gehring 2008-06-21 17:49:56 +02:00
parent 15dbc1c887
commit 8cf710acad
1 changed files with 20 additions and 10 deletions

View File

@ -129,6 +129,7 @@ ADD_DEPENDENCIES(${PROJECT_AWE_NAME} generated_headers)
# {{{ Manpages. # {{{ Manpages.
IF(GENERATE_MANPAGES) IF(GENERATE_MANPAGES)
# {{{ Lua API documentation.
MACRO(a_file_match infile regex result_var) MACRO(a_file_match infile regex result_var)
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6)
# cmake < 2.6 doesn't know FILE(STRINGS ...) # cmake < 2.6 doesn't know FILE(STRINGS ...)
@ -169,22 +170,31 @@ IF(GENERATE_MANPAGES)
VERBATIM) VERBATIM)
ADD_CUSTOM_TARGET(luadoc DEPENDS ${AWE_LUADOC_FILE}) ADD_CUSTOM_TARGET(luadoc DEPENDS ${AWE_LUADOC_FILE})
# TODO: only awesome.5 should depend on apidocgen.txt # }}}
ADD_DEPENDENCIES(${PROJECT_AWE_NAME} luadoc)
FOREACH(txtfile ${AWE_MAN_SRCS}) FOREACH(txtfile ${AWE_MAN_SRCS})
STRING(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile}) STRING(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile})
STRING(REGEX REPLACE ".xml\$" ".gz" gzipman ${xmlfile}) STRING(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile})
STRING(REGEX REPLACE ".gz\$" "" manfile ${gzfile})
STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR} gzipman ${gzipman}) ${CMAKE_CURRENT_BINARY_DIR} gzfile ${gzfile})
STRING(REGEX REPLACE ".gz\$" "" manfile ${gzipman})
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_AWECLIENT_NAME} POST_BUILD # TODO: This is still not 100% right. Actually only
COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} ${txtfile} # awesomerc.5.xml should depend on ${AWE_LUADOC_FILE}.
COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile} ADD_CUSTOM_COMMAND(COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} ${txtfile}
COMMAND ${GZIP_EXECUTABLE} -f ${manfile} OUTPUT ${xmlfile}
COMMENT "Generating manpage for ${manfile}") DEPENDS ${txtfile} ${AWE_LUADOC_FILE})
ADD_CUSTOM_COMMAND(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
OUTPUT ${manfile}
DEPENDS ${xmlfile})
ADD_CUSTOM_COMMAND(COMMAND ${GZIP_EXECUTABLE} -f ${manfile}
OUTPUT ${gzfile}
DEPENDS ${manfile})
SET(MAN_FILES ${MAN_FILES} ${gzfile})
ENDFOREACH() ENDFOREACH()
ADD_CUSTOM_TARGET(man ALL DEPENDS ${MAN_FILES})
ENDIF() ENDIF()
# }}} # }}}