Use docbook2* paths found during configure for actual build
authorMichael Hanselmann <hansmi@google.com>
Thu, 2 Oct 2008 10:22:57 +0000 (10:22 +0000)
committerMichael Hanselmann <hansmi@google.com>
Thu, 2 Oct 2008 10:22:57 +0000 (10:22 +0000)
docbook-wrapper had the names for the docbook2* programs hardcoded. This
patch changes Makefile.am and the wrapper script to pass them via
another argument.

Another issue where rapi.in was built before rapi-resources.sgml is
also fixed.

Reviewed-by: iustinp

Makefile.am
autotools/docbook-wrapper

index 94063d4..e8a5599 100644 (file)
@@ -228,24 +228,24 @@ man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
        sed -f $(REPLACE_VARS_SED) < $< > $@
 
 doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
-       $(DOCBOOK_WRAPPER) $< $@
+       $(DOCBOOK_WRAPPER) "$(DOCBOOK2PDF)" $< $@
 
 doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
-       $(DOCBOOK_WRAPPER) $< $@
+       $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $@
 
 doc/%.html: doc/%.rst
        $(RST2HTML) $< $@
 
-doc/rapi.pdf doc/rapi.html: doc/rapi-resources.sgml
+doc/rapi.pdf doc/rapi.html doc/rapi.in: doc/rapi-resources.sgml
 
 doc/rapi-resources.sgml: $(BUILD_RAPI_RESOURCE_DOC) lib/rapi/connector.py
        PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || rm -f $@
 
 man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
-       $(DOCBOOK_WRAPPER) $< $@
+       $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
 
 man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
-       $(DOCBOOK_WRAPPER) $< $@
+       $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
 
 man/footer.sgml $(TESTS): srclinks
 
index 9f53b6d..f525f16 100755 (executable)
@@ -2,23 +2,20 @@
 
 set -e
 
-input="${1}"
-output="${2}"
+if test "$#" != 3
+then
+  echo "Wrong number of arguments." >&2
+  exit 1
+fi
+
+cmd="${1}"
+input="${2}"
+output="${3}"
 
 # docbook2man inserts a date formatted using the current locale into its
 # output. Using the "C" locale makes sure it's always in the default format.
 export LC_ALL=C
 
-case "${output}" in
-  *.pdf) cmd=docbook2pdf ;;
-  *.html) cmd='docbook2html --nochunks' ;;
-  *.7|*.8) cmd=docbook2man ;;
-  *)
-    echo "Unknown filetype: ${output}" >&2
-    exit 1
-  ;;
-esac
-
 tmpdir=`mktemp -d`
 trap "rm -rf ${tmpdir}" EXIT
 
@@ -27,7 +24,7 @@ if ! ( cd `dirname ${input}` &&
 then
   echo "Building ${output} failed." >&2
   exit 1
-fi;
+fi
 
 mv "${tmpdir}/`basename "${output}"`" "${output}"