#!/bin/bash

mkdir -p bobcat
cd bobcat

    # copy all required bobcat classes from ~/src/bobcat
    #
for dir in `cat ../CLASSES`
do
    cp -rd ~/src/bobcat/$dir .
    rm -rf `find $dir -mindepth 1 -maxdepth 1 -type d`
done

rm -f */*.gch

    # change all absolute <bobcat/ locations to relative locations
    #
sed -i 's,#include <bobcat/\(.*\)>,#include "../\1/\1",' \
       `ag -l '#include <bobcat'` 

    # define the bobcat sources tgz
tar czf ../../support/bobcat.tgz *

    # remove the bobcat work-area
cd ..
rm -r bobcat
