@echo off
CLS
SETLOCAL

cd ..\

REM $Id: build-oro.bat,v 1.2 2000/09/15 05:10:17 dfs Exp $
REM --------------------------------------------
REM Default == jar
REM "bugslife"       target builds 
REM "jar"            target builds + jar
REM "war"            target builds + jar + war
REM "clean"          target removes generated files
REM "javadocs"       target builds the javadoc
REM --------------------------------------------
set TARGET=%1%


REM --------------------------------------------
REM No need to edit anything past here
REM --------------------------------------------
set BUILDFILE=build\build_win.xml
if "%TARGET%" == "" goto setdist
goto final

:setdist
set TARGET=compile
goto final

:final

if "%JAVA_HOME%" == "" goto javahomeerror
if "%catalina.home%" == "" goto tomcathomeerror

if exist %JAVA_HOME%\lib\tools.jar set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
if exist %catalina.home%\common\lib\servlet.jar set CLASSPATH=%CLASSPATH%;%catalina.home%\common\lib\servlet.jar

set ANT_LIB=build\ant.jar;build\jaxp.jar;build\parser.jar;build\ant-optional.jar

set CP=%CLASSPATH%;%ANT_LIB%

echo Classpath: %CP%
echo JAVA_HOME: %JAVA_HOME%
echo catalina.home: %catalina.home%

%JAVA_HOME%\bin\java.exe -classpath "%CP%" org.apache.tools.ant.Main -buildfile %BUILDFILE% %TARGET%

goto end


REM -----------ERROR-------------
:javahomeerror
echo "ERROR: JAVA_HOME not found in your environment."
echo "Please, set the JAVA_HOME variable in your environment to match the"
echo "location of the Java Virtual Machine you want to use."
:end
goto end

:tomcathomeerror
echo "ERROR: catalina.home not found in your environment."
echo "Please, set the catalina.home variable in your environment to match the"
echo "location of the tomcat directory you want to use."
:end

ENDLOCAL
