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

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

INSTALL=/usr/bin/install

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.
	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp 
	dh_testdir
	# Add here commands to compile the package.
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	# Add here commands to clean up after the build process.
	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	# This is only for backward compatibility. Maybe somebody relies
	# on this script, so I'll keep it included for now.
	$(INSTALL) bin/bookmarks-convert $(CURDIR)/debian/bookmarks/usr/bin/
	
	# this is the current script
	$(INSTALL) bin/xbel2bookmarks $(CURDIR)/debian/bookmarks/usr/bin/
	
	# include the original master file
	$(INSTALL) --mode=644 public_html/bookmarks.xbel $(CURDIR)/debian/bookmarks/usr/share/bookmarks/

	# these are generic xhtml 1.1 files, suitable for every browser
	bin/xbel2bookmarks --format=singlehtml --output=$(CURDIR)/debian/bookmarks/usr/share/bookmarks/bookmarks.html --input=public_html/bookmarks.xbel
	bin/xbel2bookmarks --format=splithtml --output=$(CURDIR)/debian/bookmarks/usr/share/bookmarks/public_html/ --input=public_html/bookmarks.xbel
	$(INSTALL) --mode=644 public_html/style.css $(CURDIR)/debian/bookmarks/usr/share/bookmarks/
	$(INSTALL) --mode=644 public_html/style.css $(CURDIR)/debian/bookmarks/usr/share/bookmarks/public_html/
	
	# these are special formats for widely known browsers
	bin/xbel2bookmarks --format=mozilla --output=$(CURDIR)/debian/bookmarks/usr/share/bookmarks/mozilla.html --input=public_html/bookmarks.xbel
	bin/xbel2bookmarks --format=opera --output=$(CURDIR)/debian/bookmarks/usr/share/bookmarks/opera.dat --input=public_html/bookmarks.xbel
	$(INSTALL) --mode=644 public_html/bookmarks.xbel $(CURDIR)/debian/bookmarks/usr/share/bookmarks/konqueror.xml
	
# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installman debian/bookmarks-convert.1 debian/xbel2bookmarks.1
	dh_compress
	dh_fixperms
	dh_perl
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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

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