aboutsummaryrefslogtreecommitdiff
path: root/e2fslib/et/compile_et
blob: ca19559e716c7a495d4d497f819ab08a2c2090b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
#
AWK=/usr/bin/awk
DIR="${DIR-/usr/share/et}"
ET_DIR="et"

if test "x$1" = x ; then
    echo "Usage: compile_et file"
    exit 1
fi

if test ! -f "$DIR/et_h.awk" -o ! -f "$DIR/et_c.awk" ; then
    DIR="$ET_DIR"
#    echo "Falling back to $DIR..."
    if test ! -f "$DIR/et_h.awk" -o ! -f "$DIR/et_c.awk" ; then
	echo "compile_et: Couldn't find compile_et's template files."
	exit 1
    fi
fi

ROOT=`echo $1 | sed -e s/.et$//`
BASE=`basename $ROOT`

if test ! -f "$ROOT.et" ; then
    echo "compile_et: $ROOT.et: File not found"
    exit 1;
fi

$AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h" "$ROOT.et"
$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c" "$ROOT.et"