@echo off

rem
rem Main build script for the MOA projects
rem 
rem Author: Patrick Peck
rem Version: $Id: build.bat,v 1.8 2003/05/07 18:52:02 peck Exp $
rem


rem set JAVA_HOME=C:\java\jdk1.3.1_09
rem set CATALINA_HOME=C:\Programme\Apache\Tomcat-4_1_24


if %OS%=="Windows_NT" @setlocal

set PROJECTS=
set TARGETS=

set ALLPROJECTS=common spss.server id.server

if "%JAVA_HOME%"=="" goto noJavaHome
goto checkAllProjects

:noJavaHome
echo error: JAVA_HOME not defined
goto end

:checkAllProjects
set PROJECTS=%1
shift
if not "%PROJECTS%"=="all" goto checkCommonProject
set PROJECTS=%ALLPROJECTS%
goto checkTargets

:checkCommonProject
if not "%PROJECTS%"=="common" goto checkProject
set PROJECTS=common
goto checkTargets

:checkEmptyProject
if not "%PROJECTS%"=="" goto checkProject
set PROJECTS=%ALLPROJECTS%
goto checkTargets

:checkProject
set PROJECTS=common %PROJECTS%

:checkTargets
if "%1"=="" goto runAnt
set TARGETS=%TARGETS% %1
shift
goto checkTargets

:runAnt
echo.
echo BUILDING PROJECT(S): %PROJECTS%
echo BUILDING TARGET(S) : %TARGETS%

for %%p in (%PROJECTS%) do call runAnt %%p %TARGETS%

:end
if %OS%=="Windows_NT" @endlocal