#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2015-2019 IOhannes m zmölnig <zmoelnig@iem.at>
# Description: Main Debian packaging script for libambix
#
# 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/>.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#export VERBOSE=1

DEB_BUILD_MAINT_OPTIONS = hardening=+all

H2MANPAGES=ambix-info.1 ambix-interleave.1 ambix-deinterleave.1 ambix-jplay.1 ambix-jrecord.1

%:
	dh $@

override_dh_install:
	dh_install -X "*.la"

execute_before_dh_installman: $(H2MANPAGES)

execute_after_dh_fixperms:
	find debian/*/usr/ -name "*.pd_linux" -exec chmod -x {} +

execute_after_dh_clean:
	rm -f $(H2MANPAGES)
	find samples/pd -xtype l -delete

%.1: utils/%
	cp debian/manpages/$@ $@
	-help2man \
		--libtool \
		--no-discard-stderr \
		--no-info \
		--name "AMBIsonics eXchange utility" \
		--help-option=-h \
		--version-string=-V \
		--output $@ \
		$^
