#!/usr/bin/make -f

#export DH_VERBOSE=1
export DH_COMPAT=3

configure:

build:

clean:
	rm -rf debian/libwww-doc

install:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	mkdir -p debian/libwww-doc/usr/share/doc/libwww-doc
	cp -a www.w3.org debian/libwww-doc/usr/share/doc/libwww-doc/html
	rm -f debian/libwww-doc/usr/share/doc/libwww-doc/html/robots.txt
	find debian/libwww-doc/usr/share/doc/libwww-doc -name Overview.html \
	| while read o; do \
	    d="`dirname $$o`"; i="$$d/index.html"; \
	    if test -f "$$i" && cmp "$$o" "$$i"; then \
	        rm -f "$$o"; ln -s "index.html" "$$o"; \
	    fi; \
	done
	e="debian/libwww-doc/usr/share/doc/libwww-doc/html/Library/Examples";\
	for f in `sed -n 's/^.*href="\([^"]*\.c\)".*$$/\1/p' $$e/index.html`; do \
	    ln -s ../../../../../libwww/examples/$$f $$e/; \
	done

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs 
	dh_installchangelogs
	dh_compress -X /html/
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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