#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2010 Arnout Engelen <arnouten@bzzt.net>
# Copyright © 2010-2011, Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for jack.*
#
# 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/rules/utils.mk
include /usr/share/cdbs/1/class/makefile.mk

DEB_MAKE_BUILD_TARGET = mk-local-c-common all
DEB_MAKE_INSTALL_TARGET = install prefix=$(CURDIR)/debian/jack-tools/usr
DEB_MAKE_ENVVARS = CFLAGS="$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) -std=c99 -D_POSIX_C_SOURCE=200112 " LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS)"
DEB_MAKE_INVOKE = make -C $(DEB_BUILDDIR) $(DEB_MAKE_ENVVARS)  

# Suppress optional build-dependencies
CDBS_BUILD_DEPENDS_rules_utils_copyright-check =

# bootstrap autotools files (CDBS by default only update, not create)
DEB_MAKE_CLEAN_TARGET = distclean

# avoid shipping header file for now
install/jack-tools::
	rm -rf $(cdbs_curdestdir)/usr/include

# looks like manpages aren't covered by upstream build rules
# so we handle it ourselves
build/jack-tools::
	find -maxdepth 1 -type f -name '*.text' -exec a2x -f manpage '{}' ';'
clean::
	rm -f *.1

