#!/usr/bin/make -f

# Add here any variable or target overrides you need
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/class/ant.mk

JAVA_HOME       := /usr/lib/jvm/default-java
LIBRARY_PACKAGE := jcommon
API_VERSION     := $(DEB_UPSTREAM_VERSION)

DEB_JARS := \
	junit \
	servlet-api-2.4

DEB_ANT_BUILDFILE := ant/build.xml
DEB_ANT_BUILD_TARGET := compile compile-xml javadoc
# FIXME: how to run this?
DEB_ANT_CHECK_TARGET := compile-junit-tests

clean::
	rm -rf build
	rm -rf javadoc
	rm -f $(LIBRARY_PACKAGE)-$(API_VERSION).jar 
	rm -f $(LIBRARY_PACKAGE)-xml-$(API_VERSION).jar
	rm -f lib/junit.jar lib/jcommon-$(API_VERSION)-junit.jar

install/lib$(LIBRARY_PACKAGE)-java:: 
	install -m 644 -D $(LIBRARY_PACKAGE)-$(API_VERSION).jar debian/lib$(LIBRARY_PACKAGE)-java/usr/share/java/$(LIBRARY_PACKAGE)-$(API_VERSION).jar
	ln -s $(LIBRARY_PACKAGE)-$(API_VERSION).jar debian/lib$(LIBRARY_PACKAGE)-java/usr/share/java/$(LIBRARY_PACKAGE).jar
	install -m 644 -D $(LIBRARY_PACKAGE)-xml-$(API_VERSION).jar debian/lib$(LIBRARY_PACKAGE)-java/usr/share/java/$(LIBRARY_PACKAGE)-xml-$(API_VERSION).jar
	ln -s $(LIBRARY_PACKAGE)-xml-$(API_VERSION).jar debian/lib$(LIBRARY_PACKAGE)-java/usr/share/java/$(LIBRARY_PACKAGE)-xml.jar

