#!/usr/bin/make -f
# -*- makefile -*-

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

UPVER=$(shell dpkg-parsechangelog | grep ^Version | cut -d\  -f2 | cut -d- -f1)

SKIPTEST=false
ifneq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	SKIPTEST=true
endif

%:
	dh $@ 

override_dh_auto_build:
	mh_patchpoms -plibtomcat-maven-plugin-java
	mvn-debian -Dmaven.test.skip=$(SKIPTEST) package

override_dh_auto_install:
	dh_auto_install

	mh_installpoms -plibtomcat-maven-plugin-java -e$(UPVER)
	mh_installjar -plibtomcat-maven-plugin-java -l pom.xml \
		-j$(UPVER) -e$(UPVER) \
		target/tomcat-maven-plugin-$(UPVER).jar


override_dh_auto_clean:
	dh_auto_clean
	mh_unpatchpoms -plibtomcat-maven-plugin-java
	mh_clean

	-rm -rf target/
