root / autotools / docbook-wrapper @ a2370b24
History | View | Annotate | Download (615 Bytes)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
set -e |
4 |
|
5 |
if test "$#" != 3 |
6 |
then |
7 |
echo "Wrong number of arguments." >&2 |
8 |
exit 1 |
9 |
fi |
10 |
|
11 |
cmd="${1}" |
12 |
input="${2}" |
13 |
output="${3}" |
14 |
|
15 |
# docbook2man inserts a date formatted using the current locale into its |
16 |
# output. Using the "C" locale makes sure it's always in the default format. |
17 |
export LC_ALL=C |
18 |
|
19 |
tmpdir=`mktemp -d` |
20 |
trap "rm -rf ${tmpdir}" EXIT |
21 |
|
22 |
if ! ( cd `dirname ${input}` && |
23 |
${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; ) |
24 |
then |
25 |
echo "Building ${output} failed." >&2 |
26 |
exit 1 |
27 |
fi |
28 |
|
29 |
mv "${tmpdir}/`basename "${output}"`" "${output}" |
30 |
|
31 |
# Needed for make to recognize output file |
32 |
touch "${output}" |