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

%:
	dh $@

override_dh_clean:
	# make sure PO files are always up-to-date
	debconf-updatepo --skip-pot
	dh_clean

override_dh_strip:
	dh_strip -Xmemtest86+.bin -Xmemtest86+.elf

override_dh_shlibdeps:
	: # disable it

override_dh_auto_test:
	: # disable it

override_dh_auto_install:
	: # disable it

override_dh_auto_build:
	ls debian/po --hide *.pot --hide *.in | sed 's/\.po//g' | xargs -I {} -t sh -c \
	"mkdir -p debian/locale/{}/LC_MESSAGES/ && \
	msgfmt debian/po/{}.po -o debian/locale/{}/LC_MESSAGES/memtest86+.mo"
	# Different kernels, ABIs, ld defaults, see #338603
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
	sed -i -e 's/"elf32-i386"/"elf32-i386-freebsd"/' memtest.lds memtest_shared.lds
endif
	# make iso do make all and ./makeiso.sh
	dh_auto_build -- iso

override_dh_fixperms:
	dh_fixperms

	chmod 755 $(CURDIR)/debian/memtest86+/etc/grub.d/20_memtest86+
	chmod 644 $(CURDIR)/debian/memtest86+/boot/memtest86+.bin
	chmod 644 $(CURDIR)/debian/memtest86+/boot/memtest86+_multiboot.bin
	chmod 644 $(CURDIR)/debian/memtest86+/boot/memtest86+.elf

override_dh_installdocs:
	dh_installdocs README

override_dh_installexamples:
	dh_installexamples debian/lilo.conf debian/grub-menu.lst

override_dh_installchangelogs:
	dh_installchangelogs changelog
