]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - lib/et/compile_et.sh.in
libcom_err: deal with the fact that the Hurd error messages are not zero-based
[thirdparty/e2fsprogs.git] / lib / et / compile_et.sh.in
CommitLineData
3839e657
TT
1#!/bin/sh
2#
3#
b6b65c3d 4
3839e657 5AWK=@AWK@
a2143b51 6DIR=@datadir@/et
e5fa0e30 7
91835c15
TT
8if test "$1" = "--build-tree" ; then
9 shift;
10 DIR="$ET_DIR"
11fi
12
e5fa0e30
TT
13if test "x$1" = x ; then
14 echo "Usage: compile_et file"
15 exit 1
16fi
17
05155f9b
TT
18for as_var in \
19 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
20 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
21 LC_TELEPHONE LC_TIME
22do
23 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
24 eval $as_var=C; export $as_var
25 else
26 $as_unset $as_var
27 fi
28done
29
a2143b51
TT
30if test -n "$_ET_DIR_OVERRIDE" ; then
31 DIR="$_ET_DIR_OVERRIDE";
32fi
33
56eb4d47 34if test ! -f "$DIR/et_h.awk" || test ! -f "$DIR/et_c.awk" ; then
a2143b51
TT
35 echo "compile_et: Couldn't find compile_et's template files."
36 exit 1
e5fa0e30 37fi
3839e657
TT
38
39ROOT=`echo $1 | sed -e s/.et$//`
40BASE=`basename $ROOT`
41
7eb0669d 42if test ! -f "$ROOT.et" ; then
e5fa0e30
TT
43 echo "compile_et: $ROOT.et: File not found"
44 exit 1;
45fi
46
153b4495
TT
47$AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h.$$" "outfn=${BASE}.h" "$ROOT.et"
48if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then
3f5ef964 49 rm -f ${BASE}.h.$$
153b4495 50else
3f5ef964 51 mv -f ${BASE}.h.$$ ${BASE}.h
1ceb8093 52 chmod a-w ${BASE}.h
153b4495
TT
53fi
54$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et"
55if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then
3f5ef964 56 rm -f ${BASE}.c.$$
153b4495 57else
3f5ef964 58 mv -f ${BASE}.c.$$ ${BASE}.c
1ceb8093 59 chmod a-w ${BASE}.c
153b4495 60fi