#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk

DEB_INSTALL_CHANGELOGS_ALL := ChangeLog
DEB_INSTALL_DIRS_ushare := /usr/share/ushare
DEB_INSTALL_MANPAGES_ushare := src/ushare.1
USHARE_INIT := $(CURDIR)/debian/ushare.init
DEB_UPDATE_RCD_PARAMS_ushare := defaults 80 20

# make targets
DEB_MAKE_CLEAN_TARGET    := distclean
DEB_MAKE_BUILD_TARGET    := 
DEB_MAKE_INSTALL_TARGET  := install DESTDIR=$(DEB_DESTDIR)

# configure options
DEB_CONFIGURE_NORMAL_ARGS += --enable-debug
DEB_CONFIGURE_NORMAL_ARGS += --enable-dlna
DEB_CONFIGURE_PREFIXS     += --prefix=/usr
DEB_CONFIGURE_PREFIXS     += --sysconfdir=/etc


configure/ushare::
	[ -f config.mak ] || ./configure $(DEB_CONFIGURE_NORMAL_ARGS) $(DEB_CONFIGURE_PREFIXS)

# copy init script, to use with dh_installinit
install/ushare::
	cp $(CURDIR)/scripts/ushare $(USHARE_INIT)
	mv $(CURDIR)/debian/$(cdbs_curpkg)/etc/ushare.conf $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/ushare/
	sed -i -e "s%\(/etc/ushare.conf\)%\1\n# Edit this file with 'dpkg-reconfigure $(cdbs_curpkg)'%" \
		$(CURDIR)/debian/$(cdbs_curpkg)/usr/share/ushare/ushare.conf

binary-install/ushare::
	dh_translations -p$(cdbs_curpkg)


clean::
	debconf-updatepo
