Documentation: allow installing man pages to a user defined directory

Documentation/DocBook/Makefile hard codes the prefixed path to which you
can install the built man pages (/usr/local prefix). That's unfortunate
since the user may want to install to another prefix or location (for
example, a distribution packaging the man pages may want to install to a
random temporary location in the build process).

Be flexible and allow the prefixed path to which we install man pages to be
changed with the INSTALL_MAN_PATH environment variable (and use the same
default as other similar variables like INSTALL_HDR_PATH).

Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
Herton R. Krzesinski 2017-04-20 15:57:28 -03:00 committed by Jonathan Corbet
parent d73350568c
commit 6e91b74d56

View File

@ -61,11 +61,14 @@ MAN := $(patsubst %.xml, %.9, $(BOOKS))
mandocs: $(MAN) mandocs: $(MAN)
find $(obj)/man -name '*.9' | xargs gzip -nf find $(obj)/man -name '*.9' | xargs gzip -nf
# Default location for installed man pages
export INSTALL_MAN_PATH = $(objtree)/usr
installmandocs: mandocs installmandocs: mandocs
mkdir -p /usr/local/man/man9/ mkdir -p $(INSTALL_MAN_PATH)/man/man9/
find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \ find $(obj)/man -name '*.9.gz' -printf '%h %f\n' | \
sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \ sort -k 2 -k 1 | uniq -f 1 | sed -e 's: :/:' | \
xargs install -m 644 -t /usr/local/man/man9/ xargs install -m 644 -t $(INSTALL_MAN_PATH)/man/man9/
# no-op for the DocBook toolchain # no-op for the DocBook toolchain
epubdocs: epubdocs:
@ -237,7 +240,9 @@ dochelp:
@echo ' psdocs - Postscript' @echo ' psdocs - Postscript'
@echo ' xmldocs - XML DocBook' @echo ' xmldocs - XML DocBook'
@echo ' mandocs - man pages' @echo ' mandocs - man pages'
@echo ' installmandocs - install man pages generated by mandocs' @echo ' installmandocs - install man pages generated by mandocs to INSTALL_MAN_PATH'; \
echo ' (default: $(INSTALL_MAN_PATH))'; \
echo ''
@echo ' cleandocs - clean all generated DocBook files' @echo ' cleandocs - clean all generated DocBook files'
@echo @echo
@echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml' @echo ' make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml'