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