From b33babcedaa032b901aa37aa57da46e6116509f0 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 24 Mar 2021 18:45:45 +0300 Subject: Added build system support for a man page. --- auto/help | 1 + auto/make | 33 +++++++++++++++++++++++++++------ auto/options | 6 ++++++ auto/summary | 1 + 4 files changed, 35 insertions(+), 6 deletions(-) (limited to 'auto') diff --git a/auto/help b/auto/help index 31c68567..e2b81bc7 100644 --- a/auto/help +++ b/auto/help @@ -18,6 +18,7 @@ cat << END default: "$NXT_SBINDIR" --libdir=DIRECTORY set library directory name, default: "$NXT_LIBDIR" --incdir=DIRECTORY set includes directory name, default: "$NXT_INCDIR" + --mandir=DIRECTORY set man pages directory name, default: "$NXT_MANDIR" --modules=DIRECTORY set modules directory name, default: "$NXT_MODULES" --state=DIRECTORY set state directory name, default: "$NXT_STATE" --tmp=DIRECTORY set tmp directory name, default: "$NXT_TMP" diff --git a/auto/make b/auto/make index fcf258fa..18d23917 100644 --- a/auto/make +++ b/auto/make @@ -22,10 +22,11 @@ NXT_EXEC_LINK = $NXT_EXEC_LINK $NXT_LD_OPT NXT_SHARED_LOCAL_LINK = $NXT_SHARED_LOCAL_LINK $NXT_LD_OPT NXT_MODULE_LINK = $NXT_MODULE_LINK -all: $NXT_DAEMON +all: $NXT_DAEMON manpage -.PHONY: $NXT_DAEMON +.PHONY: $NXT_DAEMON manpage $NXT_DAEMON: $NXT_BUILD_DIR/$NXT_DAEMON +manpage: $NXT_BUILD_DIR/unitd.8 END @@ -305,6 +306,19 @@ $NXT_BUILD_DIR/$NXT_DAEMON: $NXT_BUILD_DIR/$NXT_LIB_STATIC \\ END +# unitd man page + +cat << END >> $NXT_MAKEFILE + +$NXT_BUILD_DIR/unitd.8: docs/man/unitd.8.in $NXT_BUILD_DIR/nxt_auto_config.h + sed -e "s|%%ERROR_LOG_PATH%%|$NXT_LOG|" \\ + -e "s|%%PID_PATH%%|$NXT_PID|" \\ + -e "s|%%SOCKET_PATH%%|$NXT_CONTROL|" \\ + < docs/man/unitd.8.in > \$@ + +END + + # unit object files. for nxt_src in $NXT_MAKE_SRCS @@ -334,9 +348,9 @@ done cat << END >> $NXT_MAKEFILE -.PHONY: install ${NXT_DAEMON}-install install-check +.PHONY: install ${NXT_DAEMON}-install install-check manpage-install -install: ${NXT_DAEMON}-install +install: ${NXT_DAEMON}-install manpage-install install-check: @test -n "\$(DESTDIR)$NXT_PREFIX" \\ @@ -352,15 +366,22 @@ ${NXT_DAEMON}-install: $NXT_DAEMON install-check install -p $NXT_BUILD_DIR/$NXT_DAEMON \$(DESTDIR)$NXT_SBINDIR/ install -d \$(DESTDIR)$NXT_STATE +manpage-install: manpage install-check + install -d \$(DESTDIR)$NXT_MANDIR/man8 + install -p $NXT_BUILD_DIR/unitd.8 \$(DESTDIR)$NXT_MANDIR/man8/ -.PHONY: uninstall ${NXT_DAEMON}-uninstall +.PHONY: uninstall ${NXT_DAEMON}-uninstall manpage-uninstall -uninstall: ${NXT_DAEMON}-uninstall +uninstall: ${NXT_DAEMON}-uninstall manpage-uninstall ${NXT_DAEMON}-uninstall: rm -f \$(DESTDIR)$NXT_SBINDIR/$NXT_DAEMON @rmdir -p \$(DESTDIR)$NXT_SBINDIR 2>/dev/null || true +manpage-uninstall: + rm -f \$(DESTDIR)$NXT_MANDIR/man8/unitd.8 + @rmdir -p \$(DESTDIR)$NXT_MANDIR/man8 2>/dev/null || true + END cat << END >> $NXT_MAKEFILE diff --git a/auto/options b/auto/options index b6007bc2..572d8a9b 100644 --- a/auto/options +++ b/auto/options @@ -59,6 +59,7 @@ do --sbindir=*) NXT_SBINDIR="$value" ;; --libdir=*) NXT_LIBDIR="$value" ;; --incdir=*) NXT_INCDIR="$value" ;; + --mandir=*) NXT_MANDIR="$value" ;; --modules=*) NXT_MODULES="$value" ;; --state=*) NXT_STATE="$value" ;; --tmp=*) NXT_TMP="$value" ;; @@ -144,6 +145,11 @@ case "$NXT_INCDIR" in *) NXT_INCDIR="$NXT_PREFIX$NXT_INCDIR" ;; esac +case "$NXT_MANDIR" in + /*) ;; + *) NXT_MANDIR="$NXT_PREFIX$NXT_MANDIR" ;; +esac + case "$NXT_MODULES" in /*) ;; *) NXT_MODULES="$NXT_PREFIX$NXT_MODULES" ;; diff --git a/auto/summary b/auto/summary index 833d20c0..84bfbb7f 100644 --- a/auto/summary +++ b/auto/summary @@ -11,6 +11,7 @@ Unit configuration summary: sbin directory: ............ "$NXT_SBINDIR" lib directory: ............. "$NXT_LIBDIR" include directory: ......... "$NXT_INCDIR" + man pages directory: ....... "$NXT_MANDIR" modules directory: ......... "$NXT_MODULES" state directory: ........... "$NXT_STATE" tmp directory: ............. "$NXT_TMP" -- cgit