#!/bin/bash

# Copyright (c) 2015-2019 Christian Jaeger, copying@christianjaeger.ch
# This is free software. See the file COPYING.md that came bundled
# with this file.

set -eu

mydir=`dirname "$0"`

cd "$mydir"

inbase=".."
outbase="www"
configpath="./gen-config.pl"

# make it work by default without Sub::Call::Tail:
if [ "${SUB_CALL_TAIL-}" == 1 ]; then
    prefix=""
else
    prefix="."
fi

gen="../${prefix}htmlgen/gen"

if [ -e "$gen" ]; then
    "$gen" "$configpath" "$inbase" "$outbase" "$@"
else
    echo "Missing $gen, run 'meta/tail-expand' (or simply 'make test') first"
fi

