#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all


%:
	dh $@ --with systemd

override_dh_auto_install:
	install -d debian/ppc64-diag
	make -j1 install DESTDIR=$(CURDIR)/debian/ppc64-diag AM_UPDATE_INFO_DIR=no
	chmod 644 debian/ppc64-diag/etc/ppc64-diag/servevent_parse.pl
	find $(CURDIR)/debian/ppc64-diag/etc/ppc64-diag/message_catalog -type f -print0 | \
		xargs -0 chmod a-x
	install -d debian/ppc64-diag/etc/ppc64-diag/ses_pages
	chmod 644 $(CURDIR)/debian/ppc64-diag/lib/systemd/system/rtas_errd.service \
		$(CURDIR)/debian/ppc64-diag/lib/systemd/system/opal_errd.service
	rm -fr $(CURDIR)/debian/ppc64-diag/usr/share/doc/packages


override_dh_installinit:
	dh_installinit --name=rtas_errd
	dh_installinit --name=opal_errd

override_dh_clean::
	dh_clean diags/man/*gz lpd/man/*gz install.log doc/

override_dh_auto_build:
	dh_auto_build
	$(MAKE) doc
