#!/usr/bin/make -f

PLUGINS = $(shell cd plugins && find . -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)

%:
	dh $@

override_dh_auto_configure:
	python3 ./waf configure --prefix=/usr \
	--mandir=/usr/share/man \
	--strict

override_dh_auto_build:
	python3 ./waf

override_dh_auto_clean:
	python3 ./waf distclean

	find -name "*.pyc" -delete

	dh_auto_clean

override_dh_clean:
	dh_clean build/.wafpickle-linux2-34017520-20 .lock-waf_linux2_build \
	build/.lock-waf_linux2_build build/c4che/_cache.py build/c4che/build.config.py \
	build/config.log

override_dh_auto_install:
	python3 ./waf install --destdir=$(CURDIR)/debian/tmp

override_dh_install:
	dh_install

	for plugin in `cat debian/lv2-examples.install`; do \
		rm -rf debian/lv2-dev/$$plugin ; \
	done

	# move .pc files to a multiarch directory
	mkdir debian/lv2-dev/usr/lib/$(DEB_HOST_MULTIARCH)
	mv debian/lv2-dev/usr/lib/pkgconfig debian/lv2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig

override_dh_missing:
	dh_missing -Xlv2specgen -Xlv2_validate

override_dh_installchangelogs:
	dh_installchangelogs NEWS
