#!/bin/sh
# Create a stand alone executable of SWI-Prolog

if [ $# != 2 ]
then
    echo "Usage: $0 prolog saved-state"
    exit 1
fi

pl=$1
bin=$2

$pl -f none -B << _EOS_
save_program('$bin',
	[ goal		= '''\$welcome'''
	, toplevel	= prolog
	]).	
forall(library_directory(X),
       (exists_directory(X) -> make_library_index(X) ; true)).

halt.
_EOS_
