###############################################################################
# File:         TOOLSET/java.def
# Contents:     Java defines
###############################################################################

toolset		= java

s		= java
o		=
a		= class
exe		= .jar

.SUFFIXES:	.asm

# Set up version specific values
#
$(JAVA_HOME_VAR) ?= "NotSpecified"
JAVA_HOME := $($(JAVA_HOME_VAR))
export JAVA_HOME

# Verify environment variable requirements

.PHONY:		java_sdk
java_sdk:
	@$(echo) "[Toolset Java SDK $(JAVA_VER)$(ANT_TITLE)]"; \
	if [ -z "$(JAVA_HOME)" ]; then echo "Envvar $(JAVA_HOME_VAR) is not defined"; exit 2; fi;\
	if [ ! -d "$(JAVA_HOME)" ]; then echo "Directory %$(JAVA_HOME_VAR)% does not exist: $(JAVA_HOME)"; exit 2; fi;\
	if [ ! -d "$(ANT_HOME)" ]; then echo "Directory %ANT_HOME% does not  exist: $(ANT_HOME)"; exit 2; fi;

#
#   Define Ant Launcher
#   Don't use the ANT command. Under windows its a batch file with no error code
#
ANT := "$(JAVA_HOME)/bin/java" \
       -classpath "$(ANT_HOME)/lib/ant-launcher.jar" \
       "-Dant.home=$(ANT_HOME)" \
       "org.apache.tools.ant.launch.Launcher" \
       -lib "$(ANT_HOME)/lib"
ANT := $(subst \,/,$(ANT))

#
# Ensure that the java and ant components are in the path
# Needs to work on windows and Solaris
#
ifeq "$(findstring $(JAVA_HOME)/bin,$(PATH))" ""
PATH    := $(JAVA_HOME)/bin$(pathsep)$(PATH)
endif

ifeq "$(findstring $(ANT_HOME)/bin,$(PATH))" ""
PATH    := $(ANT_HOME)/bin$(pathsep)$(PATH)
endif

Path    := $(PATH)
export PATH

#
#   Allow ANT builds to be debugged, via options=args
#
ifeq ($(SHOWARGS),NONE)
ANT_VERBOSE :=
else
ANT_VERBOSE := -verbose
endif


#
