aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--README.md17
2 files changed, 28 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3352c47..b230fe5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,3 +42,14 @@ target_link_libraries(cpsc
CPSLexer
${llvm_libs}
)
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpsc.1"
+ COMMAND pandoc --standalone --from=markdown --to=man
+ "${CMAKE_CURRENT_SOURCE_DIR}/doc/cpsc.md"
+ --output "${CMAKE_CURRENT_BINARY_DIR}/cpsc.1"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/doc/cpsc.md"
+ COMMENT "Generating cpsc(1) manual"
+ VERBATIM
+)
+add_custom_target(doc DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpsc.1")
diff --git a/README.md b/README.md
index 93971c0..ba4132c 100644
--- a/README.md
+++ b/README.md
@@ -101,6 +101,23 @@ stdin/stdout/stderr, so pseudocode `INPUT` reads from the terminal or piped inpu
With `-r` alone, no permanent IR is saved; with `-r -o`, the saved IR is kept even
if execution fails.
+## Manual
+
+The command-line quick reference is in `doc/cpsc.md`. Generating the man page
+requires Pandoc; ordinary builds do not.
+
+From the project root on Linux:
+
+```bash
+sudo apt-get install pandoc
+cmake -S . -B build
+make -C build doc
+man ./build/cpsc.1
+```
+
+You can also run `make doc` inside the configured `build/` directory.
+The output is `build/cpsc.1` and is regenerated when the Markdown source changes.
+
# Note
DO NOT OPEN ANY ISSUES IF YOU COMPILE WITH VISUAL STUDIO OR ANYTHING EXCEPT MINGW-W64 (EVEN WITH MINGW-W64, WINDOWS IS LIKELY TO BE A PROBLEM MAKER)