#!/usr/bin/make -f
#
# Alex Pennace

MAJOR=0
CFLAGS=-O2 -g -D_REENTRANT

build: build-stamp
build-stamp: 
	dh_testdir
	mv po/de.gmo po/de.gmo.orig
	cp po/de.gmo.orig po/de.gmo
	./configure --prefix=/usr --enable-shared --host=$(DEB_HOST_GNU_TYPE)
	make CFLAGS="$(CFLAGS)" \
	  LINK_SHLIB='gcc -shared -Wl,-soname,libelf.so.$(MAJOR) -lc'
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	-make clean
	-mv po/de.gmo.orig po/de.gmo
	-make distclean
# distclean misses w32/Makefile; kludge around it.
	-rm -f w32/Makefile
	dh_clean build-stamp

binary: binary-arch binary-indep

binary-arch: build 
	dh_testdir
	dh_testroot
	dh_clean -k
	make instroot=`pwd`/debian/tmp install
	dh_install --sourcedir=debian/tmp --list-missing
	dh_installchangelogs ChangeLog
	dh_installdocs README
	dh_link
	dh_makeshlibs -V 'libelfg0 (>= 0.8.5)'
	dh_strip
	dh_fixperms
	dh_compress
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep: build
	true
