build: move manpages into their own directory

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-11 16:11:43 +02:00
parent 7190301321
commit 0fcba4363a
5 changed files with 12 additions and 10 deletions

View File

@ -78,10 +78,10 @@ set(AWE_SRCS
${SOURCE_DIR}/widgets/imagebox.c) ${SOURCE_DIR}/widgets/imagebox.c)
set(AWE_MAN_SRCS set(AWE_MAN_SRCS
${SOURCE_DIR}/awesome.1.txt ${SOURCE_DIR}/manpages/awesome.1.txt
${SOURCE_DIR}/awsetbg.1.txt ${SOURCE_DIR}/manpages/awsetbg.1.txt
${SOURCE_DIR}/awesome-client.1.txt ${SOURCE_DIR}/manpages/awesome-client.1.txt
${SOURCE_DIR}/awesomerc.5.txt) ${SOURCE_DIR}/manpages/awesomerc.5.txt)
add_executable(${PROJECT_AWE_NAME} add_executable(${PROJECT_AWE_NAME}
${AWE_SRCS} ${AWE_SRCS}
@ -172,6 +172,9 @@ endif()
# {{{ Manpages # {{{ Manpages
if(GENERATE_MANPAGES) if(GENERATE_MANPAGES)
if(NOT BUILD_DIR STREQUAL SOURCE_DIR)
file(MAKE_DIRECTORY ${BUILD_DIR}/manpages)
endif()
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(REPLACE ${SOURCE_DIR} string(REPLACE ${SOURCE_DIR}
@ -180,21 +183,20 @@ if(GENERATE_MANPAGES)
string(REGEX REPLACE ".gz\$" "" manfile ${gzfile}) string(REGEX REPLACE ".gz\$" "" manfile ${gzfile})
add_custom_command( add_custom_command(
COMMAND ${CAT_EXECUTABLE} ${txtfile} COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} - < ${txtfile}
| ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} - WORKING_DIRECTORY ${BUILD_DIR}/manpages
WORKING_DIRECTORY ${BUILD_DIR}
OUTPUT ${xmlfile} OUTPUT ${xmlfile}
DEPENDS ${txtfile} DEPENDS ${txtfile}
VERBATIM) VERBATIM)
add_custom_command( add_custom_command(
COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile} COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
OUTPUT ${manfile} OUTPUT ${manfile}
WORKING_DIRECTORY ${BUILD_DIR}/manpages
DEPENDS ${xmlfile}) DEPENDS ${xmlfile})
add_custom_command( add_custom_command(
COMMAND ${CAT_EXECUTABLE} ${manfile} COMMAND ${GZIP_EXECUTABLE} < ${manfile} > ${gzfile}
| ${GZIP_EXECUTABLE}
> ${gzfile}
OUTPUT ${gzfile} OUTPUT ${gzfile}
WORKING_DIRECTORY ${BUILD_DIR}/manpages
DEPENDS ${manfile} DEPENDS ${manfile}
VERBATIM) VERBATIM)