#!/bin/sh

## This file is copyright (c) 2009-2014 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`

echo "Configuring the Demeter Programming Guide build system for your machine"

echo "  configuring bin directory"
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

echo "  configuring etc directory"
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

echo "  copying map and version templates"
cp etc/map     ../lib/config/map.dpg
cp etc/version ../lib/config/version.dpg
#cp etc/map etc/version templates/latex/config/
#cp etc/map etc/version templates/pod/config/
#cp etc/map etc/version templates/mobile/config/
