#!/bin/sh # # This script is based on the sqlite publish.sh script. It is used to # generate autogenerated SQLite files for release builds. # # Create a temporary directory to hold the generated files tmp_dir="`dirname $0`/s_sql.tmp" mkdir -p "$tmp_dir" cd "$tmp_dir" # Paths are relative to dist/s_sql.tmp. # Use relative paths, so that s_sql can be run on Windows (the SQLite make # step uses Tcl, which requires a relative path to work under cygwin). 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" # Auto-generated files used in the Windows build. 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"