summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-06-08 21:50:42 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-06-08 22:00:31 +0200
commit347e6f68b2c99605787bd98b61fe30b1d26c938d (patch)
tree3c50118375e11eff5036e197243140a1d19f9cc1
parent30ee238bbc8f12a5adecc6a194627d608628ff28 (diff)
downloadsensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.tar.gz
sensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.tar.xz
sensei-raw-ctl-347e6f68b2c99605787bd98b61fe30b1d26c938d.zip
Generate a most basic manpage with help2man
-rw-r--r--CMakeLists.txt23
-rw-r--r--sensei-raw-ctl.c4
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");