#!/usr/bin/make -f

%:
	dh "$@" --with apache2

DESTDIR  := $(CURDIR)/debian/$(shell dh_listpackages)

debian/smb2www-default:
	perl Install.pl > $@

override_dh_auto_build: debian/smb2www-default
	$(MAKE) -C $(CURDIR)/debian/addons/po4a/


override_dh_auto_clean:
	$(MAKE) -C $(CURDIR)/debian/addons/po4a/ distclean
	rm -f debian/smb2www-default debian/po/*.mo

override_dh_auto_install:
	install -p -m755 -o root -g root cgi-bin/*.pl $(DESTDIR)/usr/lib/cgi-bin/samba
	install -p -m644 -o root -g root cgi-bin/*.pm $(DESTDIR)/usr/share/perl5
	install -p -m644 -o root -g root images/*.gif $(DESTDIR)/usr/share/smb2www/images

	install -p -m644 -o root -g root etc/*.lang $(DESTDIR)/usr/share/smb2www/lang
	install -p -m644 -o root -g root debian/addons/po4a/*.lang $(DESTDIR)/usr/share/smb2www/lang

	install -p -m644 debian/smb2www-default $(DESTDIR)/usr/share/smb2www/smb2www.default
	install -p -m644 debian/addons/header.template $(DESTDIR)/usr/share/smb2www/
	install -p -m644 debian/addons/trailer.template $(DESTDIR)/usr/share/smb2www/
