1 #!/bin/sh 2 # 3 # 4 5 datarootdir=@datarootdir@ 6 AWK=@AWK@ 7 DIR=@datadir@/et 8 9 if test "$1" = "--build-tree" ; then 10 shift; 11 DIR="$ET_DIR" 12 fi 13 14 if test "x$1" = x ; then 15 echo "Usage: compile_et file" 16 exit 1 17 fi 18 19 for 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 23 do 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 29 done 30 31 if test -n "$_ET_DIR_OVERRIDE" ; then 32 DIR="$_ET_DIR_OVERRIDE"; 33 fi 34 35 if 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 38 fi 39 40 ROOT=`echo $1 | sed -e s/.et$//` 41 BASE=`basename $ROOT` 42 43 if test ! -f "$ROOT.et" ; then 44 echo "compile_et: $ROOT.et: File not found" 45 exit 1; 46 fi 47 48 $AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h.$$" "outfn=${BASE}.h" "$ROOT.et" 49 if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then 50 rm -f ${BASE}.h.$$ 51 else 52 mv -f ${BASE}.h.$$ ${BASE}.h 53 chmod a-w ${BASE}.h 54 fi 55 $AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et" 56 if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then 57 rm -f ${BASE}.c.$$ 58 else 59 mv -f ${BASE}.c.$$ ${BASE}.c 60 chmod a-w ${BASE}.c 61 fi 62