message("")
message(STATUS "${BoldGreen}Starting configuring of the doc material${ColourReset}")
message("")

# The UNIX man pages
if(UNIX AND NOT APPLE)

	message(STATUS "Going to generate the man pages.")

	execute_process(COMMAND docbook-to-man msxpertsuite.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/msxpertsuite.7
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})

	execute_process(COMMAND docbook-to-man massxpert.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/massxpert.1
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})

	execute_process(COMMAND docbook-to-man minexpert.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/minexpert.1
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})

endif(UNIX AND NOT APPLE)


###############
# install stuff

# The history and licence files go in both massxpert and minexpert packages

message("Installing the doc files in ${MASSXPERT_DOC_DIR}")
install(FILES history.html readme-massxpert.txt COPYING
	DESTINATION ${MASSXPERT_DOC_DIR})

message("Installing the doc files in ${MINEXPERT_DOC_DIR}")
install(FILES history.html COPYING
	DESTINATION ${MINEXPERT_DOC_DIR})

if(UNIX AND NOT APPLE)
	install(FILES ${CMAKE_BINARY_DIR}/msxpertsuite.7
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man7)

	install(FILES ${CMAKE_BINARY_DIR}/massxpert.1
		${CMAKE_BINARY_DIR}/massxpert.1
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)

	install(FILES ${CMAKE_BINARY_DIR}/minexpert.1
		${CMAKE_BINARY_DIR}/minexpert.1
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
endif()


#############################################################
###########################
# BUILD OF THE USER MANUALS

if(BUILD_USER_MANUALS)
	add_subdirectory(user-manuals)
endif()


message("")
message(STATUS "${BoldGreen}Finished configuration of the doc material${ColourReset}")
message("")

