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