#!/usr/bin/make -f

export HOME=$(CURDIR)/.fakeHome

%:
	dh $@

override_dh_auto_clean:
	find $(CURDIR) \( -name '*.o' -o -name '*.ppu' -o -name '*.a' -o -name '*.compiled' -o -name '*.or' \) -delete -print
	rm -Rfv .fakeHome peazip-sources/dev/pea peazip-sources/dev/peazip
	dh_auto_clean

override_dh_auto_build:
	lazbuild --add-package $(CURDIR)/peazip-sources/dev/metadarkstyle/metadarkstyle.lpk
	lazbuild $(CURDIR)/peazip-sources/dev/project_peach.lpi
	lazbuild $(CURDIR)/peazip-sources/dev/project_pea.lpi

execute_after_dh_install:
	find $(CURDIR)/debian/peazip -name 'place * binary here.txt' -delete -print
	rm -Rfv $(CURDIR)/debian/peazip/usr/share/peazip/batch/Windows
	rm -Rfv $(CURDIR)/debian/peazip/usr/share/peazip/batch/bat
	rm -Rfv $(CURDIR)/debian/peazip/usr/share/peazip/batch/macOS*
	chmod +x $(CURDIR)/debian/peazip/usr/share/peazip/batch/freedesktop_integration/Nautilus-scripts/PeaZip/*

# No dbgsym packages:
override_dh_strip:
	@echo "NO THANK YOU ANYWAY but not building dbgsym packages for MX Linux"
	dh_strip --no-automatic-dbgsym
