From 347e6f68b2c99605787bd98b61fe30b1d26c938d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 8 Jun 2013 21:50:42 +0200 Subject: [PATCH] Generate a most basic manpage with help2man --- CMakeLists.txt | 23 +++++++++++++++++++++++ sensei-raw-ctl.c | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35b3ce6..69b3d17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,29 @@ if (BUILD_GUI) DESTINATION ${CMAKE_INSTALL_BINDIR}) endif (BUILD_GUI) +find_program (HELP2MAN_EXECUTABLE help2man) +if (NOT HELP2MAN_EXECUTABLE) + message (FATAL_ERROR "help2man not found") +endif () + +foreach (page ${PROJECT_NAME}) + set (page_output "${PROJECT_BINARY_DIR}/${page}.1") + list (APPEND project_MAN_PAGES "${page_output}") + add_custom_command (OUTPUT ${page_output} + COMMAND ${HELP2MAN_EXECUTABLE} -N + "${PROJECT_BINARY_DIR}/${page}" -o ${page_output} + DEPENDS ${PROJECT_NAME} + COMMENT "Generating man page for ${page}" VERBATIM) +endforeach () + +add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES}) + +foreach (page ${project_MAN_PAGES}) + string (REGEX MATCH "\\.([0-9])" manpage_suffix "${page}") + install (FILES "${page}" + DESTINATION "${CMAKE_INSTALL_MANDIR}/man${CMAKE_MATCH_1}") +endforeach () + set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "SteelSeries Sensei Raw control utility") set (CPACK_PACKAGE_VERSION ${project_VERSION}) set (CPACK_PACKAGE_VENDOR "Premysl Janouch") diff --git a/sensei-raw-ctl.c b/sensei-raw-ctl.c index 970c31b..821879d 100644 --- a/sensei-raw-ctl.c +++ b/sensei-raw-ctl.c @@ -281,8 +281,8 @@ struct options static void show_usage (const char *program_name) { - printf ("Usage: %s [OPTION]... - configure" - " SteelSeries Sensei Raw devices\n\n", program_name); + printf ("Usage: %s [OPTION]...\n", program_name); + printf ("Configure SteelSeries Sensei Raw devices.\n\n"); printf (" -h, --help Show this help\n"); printf (" --version Show program version and exit\n"); printf (" --show Show current mouse settings and exit\n");