#!/bin/bash
## The first lines arrange some environment variable in respect to ANT and XSLT. Please correct this pathes.
## You have to download ANT from www.ant.apache.org or use inside an ECLIPSE installation www.eclipse.org.

ANT_HOME="/usr/share/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145"

## The SAXON xsl translater is used inside Zmake. You must Download it from www.saxonica.com.
CLASSPATH_SAXON="/usr/share/XML_Tools/saxon9.jar"

## The ZBNFJAX_HOME environment variable is used inside Zmake. It contains the path to toolfiles. In this example it is the actual dir.
export ZBNFJAX_HOME="../../zbnfjax"

## Set the input, it is used as argument of next call and for the name of the ant.xml-file:
INPUT=zmake_test_zbnfjax.sh

## calling Zmake. It produces the ant.xml script.
java -cp ../../zbnfjax/zmake.jar:../../zbnfjax/zbnf.jar:$CLASSPATH_SAXON org.vishia.zbnf.Zmake $INPUT -tmp=tmp -zbnf4ant=xsl/ZmakeStd.zbnf -xslt4ant=xsl/ZmakeStd.xslp --report:tmp/zmake_test.log
if test $? -ge 1; then
  echo === ERROR Zmake
  exit 1
fi

## calling ANT to execute the script.
## On Execution ANT the CLASSPATH to zbnf,jar should know because org/vishia/ant/Zcopy ANT uses the CLASSPATH evironment variable:
export CLASSPATH="../../zbnfjax/zmake.jar"
$ANT_HOME/bin/ant -f tmp/ant_$INPUT.xml -DcurDir=$PWD
if test $? -ge 1; then
  echo === ERROR ANT
  exit 1
fi
