#!/usr/bin/make -f

# Use this variable to pass configure options for projectM to cmake
PROJECTM_CMAKE_FLAGS = -DINCLUDE-PROJECTM-TEST=OFF \
		-DINCLUDE-PROJECTM-JACK=ON

# Define install target dir
INSTALLDIR = $(CURDIR)/debian/tmp

# ProjectM source and build dir
SRCDIR = $(CURDIR)/src
BUILDDIR = $(SRCDIR)/build

%:
	dh $@ --list-missing --sourcedirectory=$(SRCDIR) --builddirectory=$(BUILDDIR)
.PHONY: override_dh_strip

override_dh_auto_clean:
	dh_auto_clean
	# Make sure builddir is gone
	rm -rf $(BUILDDIR)

	# "Make clean" forgets these files
	rm -f $(CURDIR)/src/libprojectM/libprojectM.pc
	rm -f $(CURDIR)/src/libprojectM/config.inp
	rm -f $(CURDIR)/src/projectM-qt/libprojectM-qt.pc

override_dh_auto_configure:
	dh_auto_configure -- $(PROJECTM_CMAKE_FLAGS)

override_dh_auto_install:
	dh_auto_install --destdir=$(INSTALLDIR)

	mkdir -p $(INSTALLDIR)/usr/lib/libvisual-0.4
	-mv $(INSTALLDIR)/usr/lib/*/libvisual-0.4 $(INSTALLDIR)/usr/lib/libvisual-0.4

override_dh_strip:
	dh_strip --dbg-package=projectm-dbg
