#!/bin/bash

# See talk.txt for a short "paper" explaining this work.

# To certify systemcalls.lisp and supporting y86 books, run:
# ./README
# in this directory.  But if you're not at UT, you'll first want to
# change the pathnames in the Makefile in this directory and also
# those under y86-basic-changes/.

cp -pr /projects/acl2/devel/books/models/y86/y86-basic y86-basic-new

# Before proceeding, check whether x86-state.lisp has changed.
if [ "`diff y86-basic-original/common/x86-state.lisp y86-basic-new/common/x86-state.lisp`" ] ; then \
   echo "Error: Difference found between" ; \
   echo "       y86-basic-original/common/x86-state.lisp" ; \
   echo "       and" ; \
   echo "       y86-basic-new/common/x86-state.lisp." ; \
   echo "       Before proceeding, update both" ; \
   echo "       y86-basic-original/common/x86-state.lisp" ; \
   echo "       and" ; \
   echo "       y86-basic-changes/common/x86-state.lisp" ; \
   echo "       as appropriate to match:" ; \
   echo "       y86-basic-new/common/x86-state.lisp" ; \
   exit 1 ; \
   fi

mv y86-basic-new/common/x86-state.lisp y86-basic-new/common/x86-state.lisp.orig
cp -p y86-basic-changes/Makefile y86-basic-new/
cp -p y86-basic-changes/common/x86-state.lisp y86-basic-new/common/
cp -p y86-basic-changes/common/Makefile y86-basic-new/common/
cp -p y86-basic-changes/y86/Makefile y86-basic-new/y86/
cd y86-basic-new/
make clean
make -j 8 ACL2=/p/bin/acl2h ACL2_SYSTEM_BOOKS=/projects/acl2/v6-1-64-hons/books
cd ..
make clean
make ACL2=/p/bin/acl2h ACL2_SYSTEM_BOOKS=/projects/acl2/v6-1-64-hons/books

# Then you can run the tests in the multiline comment at the end of
# systemcalls.lisp.
