#!/bin/sh set -e 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 tmpdir=`mktemp -d` trap "rm -rf ${tmpdir}" EXIT if ! ( cd `dirname ${input}` && ${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; ) then echo "Building ${output} failed." >&2 exit 1 fi mv "${tmpdir}/`basename "${output}"`" "${output}" # Needed for make to recognize output file touch "${output}"