#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

egdir = debian/libreadline-java-doc/usr/share/doc/libreadline-java-doc/examples
export JAVA_HOME:=/usr/lib/jvm/default-java

%:
	dh $@ --no-parallel --with javahelper

override_dh_auto_build:
	dh_auto_build -- JAVAC=$(JAVA_HOME)/bin/javac JC_FLAGS="-source 1.8 -target 1.8 -h native" CC=gcc \
	  JAVAINCLUDE=$(JAVA_HOME)/include \
	  JAVANATINC=$(JAVA_HOME)/include \
	  T_LIBS="JavaReadline JavaEditline" jar build-native apidoc

override_dh_auto_install:
	# Skip auto-install - it causes a rebuild and we do not need it.

override_dh_auto_test:
	# Skip tests - they dont work.

override_dh_installexamples:
	dh_installexamples
	# Tidy up the examples directory.
	test ! -d $(egdir) || rm $(egdir)/test/Makefile
	test ! -d $(egdir) || mv $(egdir)/libreadline-java-doc.README.test $(egdir)/README.test

