tmp_dir="`dirname $0`/s_sql.tmp"
mkdir -p "$tmp_dir"
cd "$tmp_dir"
sqldir=../../lang/sql/sqlite
destdir=../../lang/sql/generated
copy_if_changes()
{
f1="$1"
f2="$2"
cmp $f1 $f2 > /dev/null 2>&1 ||
(rm -f $f1 && cp $f2 $f1 && echo "Updated $f1")
}
mkdir -p $destdir
$sqldir/configure
make sqlite3.c
copy_if_changes "$destdir/sqlite3.c" "sqlite3.c"
copy_if_changes "$destdir/sqlite3.h" "sqlite3.h"
copy_if_changes "$destdir/keywordhash.h" "keywordhash.h"
copy_if_changes "$destdir/opcodes.c" "opcodes.c"
copy_if_changes "$destdir/opcodes.h" "opcodes.h"
copy_if_changes "$destdir/parse.c" "parse.c"
copy_if_changes "$destdir/parse.h" "parse.h"
cd ..
rm -rf "$tmp_dir"