#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2002 Guenter Geiger <geiger@debian.org>
# Copyright © 2011 IOhannes m zmölnig <zmoelnig@iem.at>
# Description: Main Debian packaging script for pd-iemmatrix
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/class/pd.mk
include /usr/share/cdbs/1/rules/utils.mk

BUILD_DATE:=$(shell date -u -d "$$(dpkg-parsechangelog -SDate)" +"%Y/%m/%d at %H:%M:%S UTC")


# regenerate configure, so that patches to configure.ac take effect
DEB_AUTO_UPDATE_ACLOCAL = ,
DEB_AUTO_UPDATE_AUTOCONF = ,

DEB_CONFIGURE_EXTRA_FLAGS += --with-extension=pd_linux --with-build-date="$(BUILD_DATE)"

# remove generated files not cleaned up on "make clean"
clean::
	-rm -f VERSION.txt doc/iemmatrix-meta.pd

binary-predeb/pd-iemmatrix::
	# remove libtools leftovers
	find "$(cdbs_curdestdir)" -name "*.la" -delete
	# we rather link to the debian provided GPL-2
	-rm -f "$(cdbs_curdestdir)/usr/lib/pd/extra/iemmatrix/LICENSE.txt"
