From 1b9285158399abdd41d9810c2a20fb226e65b07f Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 18 Mar 2018 18:38:19 -0700 Subject: [PATCH] install-html: allow RST2HTML to override rst2html Switch default name for .rst to .html converter to "rst2html". If the RST2HTML variable has been set use that value instead. Complain if it can't be found before trying to run it. In verbose (V=1) mode show the actual value that will be used. Signed-off-by: Kyle J. McKay --- INSTALL | 11 ++++++++--- Makefile.mak | 31 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index 3329775..e1bc368 100644 --- a/INSTALL +++ b/INSTALL @@ -10,7 +10,7 @@ Normally you can just do "make" followed by "make install", and that will install the tg program in your own ~/bin/ directory. If you want to do a global install, you can do - # make prefix=/usr install ;# as root + make prefix=/usr install # as root (or prefix=/usr/local, of course). Just like any program suite that uses $prefix, the built results have some paths encoded, which are derived from @@ -20,9 +20,14 @@ The Makefile does not currently install the bash completion support in contrib/tg-completion.bash. Instructions for installing that file are at the top of that file. -To install the html version of the help you need rst2html.py and then use +To install the html version of the help you need rst2html and then use "make html" followed by "make install-html". The same use of prefix= -applies here as well. +applies here as well. Set RST2HTML to the location of the rst2html +executabile if it's not named "rst2html" or not located in $PATH. Also +note that "make doc" and "make install-doc" will accomplish the same thing. + +The standard DESTDIR variable is supported to install to an intermediate +location before moving to the final intended destination via some other means. The TopGit git repository can be found at: http://repo.or.cz/topgit/pro diff --git a/Makefile.mak b/Makefile.mak index c1edc07..2025f4c 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -2,6 +2,29 @@ .POSIX: +# +## Makefile variables +## +## V - set to 1 to get more verbose rule output +## Default is empty +## Any value other than empty or 0 will also activate verbose mode +## +## DESTDIR - installation path prefix +## Default is empty +## The value is prefixed verbatim to the installation paths when +## using any of the "install" targets but is otherwise ignored. +## This allows the executables to be configured for one location +## but installed to an alternate location before being moved to +## their final location. The executables will not work correctly +## until they are then relocated into their final location. +## +## RST2HTML - location of rst2html.py +## Default is "rst2html" +## Only required to `make doc` aka `make html` (i.e. topgit.html) +## If "rst2html" is not in $PATH this must be set +## in order to successfully `make doc` (or `make html`) +# + # Default target is all all: @@ -33,6 +56,9 @@ AT = @ Q_ = $(AT) Q_0 = $(Q_) Q = $(Q_$(V)) +QPOUND_ = $(AT)$(POUND) +QPOUND_0 = $(QPOUND_) +QPOUND = $(QPOUND_$(V)) QSED_ = $(AT)echo "[SED] $@" && QSED_0 = $(QSED_) QSED = $(QSED_$(V)) @@ -137,7 +163,10 @@ tg-tg.txt: README create-html-usage.pl $(commands_in) $(QHELPTG)perl ./create-html-usage.pl --text < README > $@ topgit.html: README create-html-usage.pl $(commands_in) - $(QHTMLTOPGIT)perl ./create-html-usage.pl < README | rst2html.py - $@ && \ + $(Q)command -v "$${RST2HTML:-rst2html}" >/dev/null || \ + { echo "need $${RST2HTML:-rst2html} to make $@" >&2; exit 1; } + $(QPOUND)echo "# \$${RST2HTML:-rst2html} is \"$${RST2HTML:-rst2html}\"" + $(QHTMLTOPGIT)perl ./create-html-usage.pl < README | "$${RST2HTML:-rst2html}" - $@ && \ perl -i -pe 's/ /\ /g' "$@" $(html_out): create-html.sh -- 2.11.4.GIT