#
# Makefile for creating threddsBrowser.jar
#
# JAVA_HOME must be defined as the location of a Java Development Kit
# Also the TOOLSUI_JAR file define below must exist
#

TOOLSUI_JAR = toolsUI/toolsUI-4.1.jar

JAVA_SOURCE_FILES = $(wildcard src/gov/noaa/pmel/ferret/threddsBrowser/*.java)

.PHONY : all
all : threddsBrowser.jar

.PHONY : clean
clean : 
	rm -fr threddsBrowser.jar bin

threddsBrowser.jar : $(JAVA_SOURCE_FILES) Makefile
	rm -fr threddsBrowser.jar bin
	mkdir bin
ifdef JAVA_HOME
	$(JAVA_HOME)/bin/javac -sourcepath src -classpath bin:$(TOOLSUI_JAR) -d bin $(JAVA_SOURCE_FILES)
	$(JAVA_HOME)/bin/jar cf threddsBrowser.jar -C bin gov/noaa/pmel/ferret/threddsBrowser
else
	javac -sourcepath src -classpath bin:$(TOOLSUI_JAR) -d bin $(JAVA_SOURCE_FILES)
	jar cf threddsBrowser.jar -C bin gov/noaa/pmel/ferret/threddsBrowser
endif

