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

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

build: link-stamp build-stamp
build-stamp:
	dh_testdir
	$(MAKE) version
	touch build-stamp

clean: link-stamp
	dh_testdir
	dh_testroot
	rm -f build-stamp
	dh_clean

# Build architecture-dependent files here.
binary-arch: link-stamp build
# We have nothing to do by default.

# Build architecture-independent files here.
binary-indep: link-stamp build
	dh_testdir
	dh_testroot
	dh_clean
	$(MAKE) DESTDIR=debian/tmp install
	dh_installdocs README gendiff.txt
	dh_installexamples
	dh_installmenu
	dh_installmanpages
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Fix links when checking out of cvs by calling this target.
link-stamp:
	sh -e debian/fixlinks
	touch link-stamp

VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')

# Update the web page. Not intended for use by anyone except the author.
installhook:
	cp debian/changelog /home/pub/programs/alien/CHANGES
	echo $(VERSION) > /home/pub/programs/alien/LATEST-VERSION-IS
	rm /home/ftp/pub/code/alien/* || true
	cd /home/ftp/pub/code/alien; \
		ln -sf ../debian/alien_$(VERSION).tar.gz alien_$(VER).tar.gz; \
		ln -sf ../debian/alien_$(VERSION).tar.gz alien.tar.gz
	fakeroot alien --to-slp /home/joey/debian/public/alien_*.deb
	mv alien-$(VERSION).slp /home/ftp/pub/code/alien/
	make rpm
	ln -s /home/ftp/pub/code/alien/alien-$(VERSION).slp \
		/home/ftp/pub/code/alien/alien.slp

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
