#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=rscds
dt=debian/$(package)

build: inc htdocs debian/$(package)-phpdoc.ini debian/$(package)-phpdoc.ini.in
	$(checkdir)
	cd ~andrew/projects/phpdoc/phpDocumentor-1.2.3 && ./phpdoc -c $(CURDIR)/debian/$(package)-phpdoc.ini
	touch build

# PHPDoc operational setup sucks.  Badly.
debian/$(package)-phpdoc.ini: debian/$(package)-phpdoc.ini.in
	sed -e"s@##projectroot##@$(CURDIR)@g" <debian/$(package)-phpdoc.ini.in >debian/$(package)-phpdoc.ini

clean:
	$(checkdir)
	rm -f build
	rm -f `find . -name "*~"`
	-rm -rf $(dt) debian/files* core debian/substvars debian/html

binary-indep: checkroot build
	$(checkdir)
	-rm -rf $(dt)
	dh_clean -k
	# dh_installdebconf
	install -d $(dt) $(dt)/DEBIAN $(dt)/etc/$(package) \
		$(dt)/usr/share/$(package) $(dt)/usr/share/doc/$(package) \
		$(dt)/var/lib/$(package)
	cp -a htdocs $(dt)/usr/share/$(package)
	cp -a dba $(dt)/usr/share/$(package)
	cp -a inc $(dt)/usr/share/$(package)
	cp -a locale $(dt)/usr/share/$(package)
	# cp -a admin $(dt)/usr/share/$(package)
	dh_installdocs
	rm -rf $(dt)/usr/share/doc/$(package)/website/wiki
	dh_installchangelogs
	dh_fixperms
	install -m 1777 -d $(dt)/var/lib/$(package)/attachments
	dh_installdeb
	dpkg-gencontrol -P$(dt)
	dpkg --build $(dt) ..

binary-arch: checkroot build
	$(checkdir)
# There are no architecture-dependent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

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