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

-include /usr/share/dpkg/buildflags.mk

p_base=glite-jobid-api-java
p_lib=libglite-jobid-api-java
p_doc=libglite-jobid-api-java-doc

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

configure: configure-stamp
configure-stamp:
	dh_testdir
	/usr/bin/perl ./configure --thrflavour= --nothrflavour= --root=/ --prefix=/usr --libdir=lib --docdir=/usr/share/doc/$(p_base) --project=emi --module jobid.api-java
	touch $@

build: build-indep

build-indep: build-stamp

build-stamp: configure-stamp
	dh_testdir
	CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE)
	CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE) check
	touch $@

clean: configure-stamp
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-stamp
	-$(MAKE) clean
	rm -f Makefile.inc config.status *.spec
	dh_clean

install: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	mkdir -p debian/$(p_doc)/usr/share/doc
	mkdir -p debian/$(p_lib)/usr/share/doc
	mv debian/tmp/usr/share/doc/$(p_base) debian/$(p_doc)/usr/share/doc/$(p_lib)

binary-indep: install
	dh_testdir
	dh_testroot
	dh_installchangelogs project/ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installman
	dh_installlogrotate
	dh_installcron
	dh_install --fail-missing
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep
