1#!/bin/sh 2# 3# 4 5datarootdir=@datarootdir@ 6AWK=@AWK@ 7DIR=@datadir@/et 8 9if test "$1" = "--build-tree" ; then 10 shift; 11 DIR="$ET_DIR" 12fi 13 14if test "x$1" = x ; then 15 echo "Usage: compile_et file" 16 exit 1 17fi 18 19for as_var in \ 20 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ 21 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ 22 LC_TELEPHONE LC_TIME 23do 24 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then 25 eval $as_var=C; export $as_var 26 else 27 $as_unset $as_var 28 fi 29done 30 31if test -n "$_ET_DIR_OVERRIDE" ; then 32 DIR="$_ET_DIR_OVERRIDE"; 33fi 34 35if test ! -f "$DIR/et_h.awk" || test ! -f "$DIR/et_c.awk" ; then 36 echo "compile_et: Couldn't find compile_et's template files." 37 exit 1 38fi 39 40ROOT=`echo $1 | sed -e s/.et$//` 41BASE=`basename $ROOT` 42 43if test ! -f "$ROOT.et" ; then 44 echo "compile_et: $ROOT.et: File not found" 45 exit 1; 46fi 47 48$AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h.$$" "outfn=${BASE}.h" "$ROOT.et" 49if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then 50 rm -f ${BASE}.h.$$ 51else 52 mv -f ${BASE}.h.$$ ${BASE}.h 53 chmod a-w ${BASE}.h 54fi 55$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et" 56if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then 57 rm -f ${BASE}.c.$$ 58else 59 mv -f ${BASE}.c.$$ ${BASE}.c 60 chmod a-w ${BASE}.c 61fi 62