diff --git a/docs/cmdline-opts/CMakeLists.txt b/docs/cmdline-opts/CMakeLists.txt index 6a3a1c5f6..99ec66c31 100644 --- a/docs/cmdline-opts/CMakeLists.txt +++ b/docs/cmdline-opts/CMakeLists.txt @@ -29,8 +29,8 @@ transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc. include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") add_custom_command(OUTPUT "${MANPAGE}" - COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" "./gen.pl" mainpage ${DPAGES} > "${MANPAGE}" - COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" "./gen.pl" ascii ${DPAGES} > "${ASCIIPAGE}" + COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/scripts/managen mainpage ${DPAGES} > "${MANPAGE}" + COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/scripts/managen ascii ${DPAGES} > "${ASCIIPAGE}" VERBATIM ) add_custom_target(generate-curl.1 ALL DEPENDS "${MANPAGE}") diff --git a/docs/cmdline-opts/MANPAGE.md b/docs/cmdline-opts/MANPAGE.md index 16c203608..252e9e86a 100644 --- a/docs/cmdline-opts/MANPAGE.md +++ b/docs/cmdline-opts/MANPAGE.md @@ -103,11 +103,16 @@ getting spellchecked by CI jobs): `%DATE`, `%VERSION` and `%GLOBALS`. ## Generate -`./gen.pl mainpage` +`managen mainpage [list of markdown option file names]` This command outputs a single huge nroff file, meant to become `curl.1`. The full curl man page. -`./gen.pl listhelp` +`managen ascii [list of markdown option file names]` + +This command outputs a single text file, meant to become `curl.txt`. The full +curl man page in text format, used to build `tool_hugehelp.c`. + +`managen listhelp` Generates a full `curl --help` output for all known command line options. diff --git a/docs/cmdline-opts/Makefile.am b/docs/cmdline-opts/Makefile.am index 50d135270..81a4afe1b 100644 --- a/docs/cmdline-opts/Makefile.am +++ b/docs/cmdline-opts/Makefile.am @@ -31,13 +31,15 @@ man_MANS = $(MANPAGE) include Makefile.inc -EXTRA_DIST = $(DPAGES) MANPAGE.md gen.pl $(SUPPORT) CMakeLists.txt mainpage.idx +EXTRA_DIST = $(DPAGES) MANPAGE.md $(SUPPORT) CMakeLists.txt mainpage.idx GEN = $(GN_$(V)) GN_0 = @echo " GENERATE" $@; GN_1 = GN_ = $(GN_0) +MANAGEN=$(abs_top_srcdir)/scripts/managen + if BUILD_DOCS CLEANFILES = $(MANPAGE) $(ASCIIPAGE) @@ -45,11 +47,14 @@ all: $(MANPAGE) $(ASCIIPAGE) endif -$(MANPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc gen.pl - $(GEN)(rm -f $(MANPAGE) && (cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES)) > manpage.tmp.$$$$ && mv manpage.tmp.$$$$ $(MANPAGE)) +$(MANPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc $(MANAGEN) + $(GEN)(rm -f $(MANPAGE) && (cd $(srcdir) && @PERL@ $(MANAGEN) mainpage $(DPAGES)) > manpage.tmp.$$$$ && mv manpage.tmp.$$$$ $(MANPAGE)) -$(ASCIIPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc gen.pl - $(GEN)(rm -f $(ASCIIPAGE) && (cd $(srcdir) && @PERL@ ./gen.pl ascii $(DPAGES)) > asciipage.tmp.$$$$ && mv asciipage.tmp.$$$$ $(ASCIIPAGE)) +$(ASCIIPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc $(MANAGEN) + $(GEN)(rm -f $(ASCIIPAGE) && (cd $(srcdir) && @PERL@ $(MANAGEN) ascii $(DPAGES)) > asciipage.tmp.$$$$ && mv asciipage.tmp.$$$$ $(ASCIIPAGE)) listhelp: - ./gen.pl listhelp $(DPAGES) > $(top_builddir)/src/tool_listhelp.c + $(MANAGEN) listhelp $(DPAGES) > $(top_builddir)/src/tool_listhelp.c + +listcats: + @$(MANAGEN) listcats $(DPAGES) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2d136d8ed..ad4877194 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -23,7 +23,7 @@ ########################################################################### EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \ - mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd + mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@ diff --git a/docs/cmdline-opts/gen.pl b/scripts/managen similarity index 99% rename from docs/cmdline-opts/gen.pl rename to scripts/managen index eeaabd2ec..d950bd586 100755 --- a/docs/cmdline-opts/gen.pl +++ b/scripts/managen @@ -27,7 +27,7 @@ This script generates the manpage. -Example: gen.pl [files] > curl.1 +Example: managen [files] > curl.1 Dev notes: @@ -1031,7 +1031,7 @@ sub mainpage { .\\" * .\\" ************************************************************************** .\\" -.\\" DO NOT EDIT. Generated by the curl project gen.pl man page generator. +.\\" DO NOT EDIT. Generated by the curl project managen man page generator. .\\" .TH curl 1 "$date" "curl $version" "curl Manual" HEADER @@ -1108,7 +1108,7 @@ sub getargs { return; } - print "Usage: gen.pl [files]\n"; + print "Usage: managen [files]\n"; } #------------------------------------------------------------------------ diff --git a/src/tool_help.h b/src/tool_help.h index a7906266e..a05cd8458 100644 --- a/src/tool_help.h +++ b/src/tool_help.h @@ -40,8 +40,7 @@ struct helptxt { /* * The bitmask output is generated with the following command ------------------------------------------------------------ - cd $srcroot/docs/cmdline-opts - ./gen.pl listcats *.d + make -C docs/cmdline-opts listcats */ #define CURLHELP_HIDDEN 1u << 0u diff --git a/tests/data/test1478 b/tests/data/test1478 index b489ac038..c05766740 100644 --- a/tests/data/test1478 +++ b/tests/data/test1478 @@ -19,7 +19,7 @@ src/tool_listhelp.c is in sync with docs/cmdline-opts -%SRCDIR/../docs/cmdline-opts/gen.pl listhelp %SRCDIR/../docs/cmdline-opts/*.md +%SRCDIR/../scripts/managen listhelp %SRCDIR/../docs/cmdline-opts/*.md