• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3#
4
5AWK=@AWK@
6DIR=@datadir@/et
7
8if test "$1" = "--build-tree" ; then
9    shift;
10    DIR="$ET_DIR"
11fi
12
13if test "x$1" = x ; then
14    echo "Usage: compile_et file"
15    exit 1
16fi
17
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
30if test -n "$_ET_DIR_OVERRIDE" ; then
31    DIR="$_ET_DIR_OVERRIDE";
32fi
33
34if test ! -f "$DIR/et_h.awk" || test ! -f "$DIR/et_c.awk" ; then
35    echo "compile_et: Couldn't find compile_et's template files."
36    exit 1
37fi
38
39ROOT=`echo $1 | sed -e s/.et$//`
40BASE=`basename $ROOT`
41
42if test ! -f "$ROOT.et" ; then
43    echo "compile_et: $ROOT.et: File not found"
44    exit 1;
45fi
46
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
49    rm -f ${BASE}.h.$$
50else
51    mv -f ${BASE}.h.$$ ${BASE}.h
52    chmod a-w ${BASE}.h
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
56    rm -f ${BASE}.c.$$
57else
58    mv -f ${BASE}.c.$$ ${BASE}.c
59    chmod a-w ${BASE}.c
60fi
61