#!/bin/sh

## This file is copyright (c) 2007-2008 Bruce Ravel and
## licensed under The Creative Commons Attribution-ShareAlike License.

## use the Template Toolkit to configure itself for building the
## Athena document.  This runs tpage on the templates in the bin/ and
## etc/ directories to generate the actual scripts and cfg files
## needed to build the various forms of the doc

id=`pwd`

if [ ! $1 ]; then echo "Configuring the Athena User's Guide build system for your machine"; fi

if [ ! $1 ]; then echo "  configuring bin directory"; fi
files="build tex" # texbw pod mobile"
for b in $files; do
    rm -f bin/$b
    tpage --define installdir=$id bin/$b.tt > bin/$b
    chmod +x bin/$b
done

if [ ! $1 ]; then echo "  configuring etc directory"; fi
files="ttree ttree_tex" # ttree_texbw ttree_pod ttree_mobile"
for b in $files; do
    rm -f etc/$b
    tpage --define installdir=$id etc/$b.tt > etc/$b.cfg
done

if [ ! $1 ]; then echo "  copying map and version templates"; fi
cp etc/map     ../lib/config/map.athena
cp etc/version ../lib/config/version.athena
cp etc/map     ../latex/config/map.athena
cp etc/version ../latex/config/version.athena
#cp etc/map etc/version templates/pod/config/
#cp etc/map etc/version templates/mobile/config/
