mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-07-27 07:24:01 +00:00
man: add build infrastructure to generate devel man pages
this is useful to include ipc_common errors into all man pages Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> Reviewed-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
parent
10faac6509
commit
902d03f28b
@ -37,6 +37,7 @@ EXTRA_DIST = autogen.sh $(SPEC).in \
|
||||
build-aux/git-version-gen \
|
||||
build-aux/gitlog-to-changelog \
|
||||
build-aux/release.mk \
|
||||
build-aux/genman \
|
||||
.version
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
52
build-aux/genman
Executable file
52
build-aux/genman
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Set variables
|
||||
# in - input man page (something_foo.3.in)
|
||||
# out - output file (something_foo.3)
|
||||
# common - common ipc error file
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
common="$3"
|
||||
|
||||
# make sure to trap on error and ctrl+c
|
||||
# so we can cleanup our temporary files
|
||||
# and provide error back to Makefile
|
||||
cleanup() {
|
||||
rm -f "$out"-t "$out"
|
||||
}
|
||||
|
||||
trap "cleanup" ABRT
|
||||
trap "cleanup" QUIT
|
||||
trap "cleanup" TERM
|
||||
trap "cleanup" INT
|
||||
trap "cleanup" ERR
|
||||
|
||||
# Determine build date in man page format YYYY-MM-DD
|
||||
date="$(LC_ALL=C date "+%F")"
|
||||
|
||||
# do the hack.. it looks ugly but it works fine
|
||||
|
||||
# remove temporary file
|
||||
rm -f "$out"-t
|
||||
|
||||
# insert the $common ipc error file in the man page
|
||||
if grep -q @COMMONIPCERRORS@ "$in"; then
|
||||
awk "{print}(\$1 ~ /@COMMONIPCERRORS@/){exit 0}" "$in" > "$out"-t
|
||||
cat "$common" >> "$out"-t
|
||||
awk -v p=0 "(\$1 ~ /@COMMONIPCERRORS@/){p = 1} {if(p==1)print}" "$in" >> "$out"-t
|
||||
else
|
||||
cp "$in" "$out"-t
|
||||
fi
|
||||
|
||||
# substitute BUILDDATE with precalculated date
|
||||
# and remove COMMONIPCERRORS tag from above
|
||||
sed -i \
|
||||
-e 's#@BUILDDATE@#'$date'#g' \
|
||||
-e 's#@COMMONIPCERRORS@##g' \
|
||||
"$out"-t
|
||||
|
||||
# move in place as requested
|
||||
mv "$out"-t "$out"
|
@ -66,6 +66,7 @@ AC_CHECK_PROGS([PKGCONFIG], [pkg-config])
|
||||
AC_CHECK_PROGS([AUGTOOL], [augtool])
|
||||
AC_CHECK_PROGS([DOT], [dot])
|
||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||
AC_CHECK_PROGS([AWK], [awk])
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([dl], [dlopen])
|
||||
|
@ -39,8 +39,25 @@ xml_man = corosync-xmlproc.8 \
|
||||
|
||||
INDEX_HTML = index.html
|
||||
|
||||
autogen_man =
|
||||
|
||||
autogen_common = ipc_common.sh.errors
|
||||
|
||||
EXTRA_DIST = $(INDEX_HTML) \
|
||||
$(xml_man)
|
||||
$(xml_man) \
|
||||
$(autogen_man:%=%.in) \
|
||||
$(autogen_common)
|
||||
|
||||
man_MANS = $(autogen_man)
|
||||
|
||||
%.3: %.3.in $(autogen_common) $(top_srcdir)/build-aux/genman
|
||||
@echo Generating $@ man page && \
|
||||
rm -f $@-t $@ && \
|
||||
$(top_srcdir)/build-aux/genman \
|
||||
$(srcdir)/$@.in \
|
||||
$(builddir)/$@-t \
|
||||
$(srcdir)/$(autogen_common) && \
|
||||
mv $@-t $@
|
||||
|
||||
dist_man_MANS = \
|
||||
corosync.conf.5 \
|
||||
@ -142,7 +159,7 @@ endif
|
||||
|
||||
if BUILD_HTML_DOCS
|
||||
|
||||
HTML_DOCS = $(dist_man_MANS:%=%.html)
|
||||
HTML_DOCS = $(dist_man_MANS:%=%.html) $(man_MANS:%=%.html)
|
||||
|
||||
%.html: %
|
||||
$(GROFF) -mandoc -Thtml $^ > $@
|
||||
@ -158,6 +175,9 @@ uninstall-local:
|
||||
all-local: $(HTML_DOCS)
|
||||
|
||||
clean-local:
|
||||
rm -rf $(HTML_DOCS)
|
||||
rm -rf $(HTML_DOCS) $(autogen_man)
|
||||
|
||||
else
|
||||
clean-local:
|
||||
rm -rf $(autogen_man)
|
||||
endif
|
||||
|
3
man/ipc_common.sh.errors
Normal file
3
man/ipc_common.sh.errors
Normal file
@ -0,0 +1,3 @@
|
||||
.PP
|
||||
Common errors go here
|
||||
|
Loading…
Reference in New Issue
Block a user