#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2012-2014 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Green End SFTP Server
#
# 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 3, 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/>.

DEB_AUTO_UPDATE_AUTOCONF = ,
DEB_AUTO_UPDATE_AUTOHEADER = ,
DEB_AUTO_UPDATE_ACLOCAL = ,
DEB_AUTO_UPDATE_AUTOMAKE = ,
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

DEB_UPSTREAM_PACKAGE = sftpserver
DEB_UPSTREAM_URL = http://www.greenend.org.uk/rjk/sftpserver

# Needed by upstream build process
CDBS_BUILD_DEPENDS += , libreadline-dev

# Needed by upstream regresssion testing
CDBS_BUILD_DEPENDS += , python, python-paramiko

# Preserve upstream shipped cruft
DEB_CLEAN_EXCLUDE = tests/version2~

# ignore files unused during build
DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^Makefile.in|aclocal.m4|configure|config.h.in|config\.aux/.*|debian/(changelog|copyright(|_hints|_newhints))$

# We use autotools too modern for default CDBS
DEB_CONFIGURE_LIBEXECDIR = /usr/lib

DEB_MAKE_CHECK_TARGET = check

# Some regression tests fail if ls output is localized
$(cdbs_make_check_stamps) : export LC_MESSAGES=C

# put aside autogenerated files during build
DEB_UPSTREAM_CRUFT_MOVE = Makefile.in aclocal.m4 configure config.h.in
DEB_UPSTREAM_CRUFT_MOVE += $(patsubst %,config.aux/%,config.guess config.sub depcomp install-sh missing)

# (re)generate most possible autotools files
DEB_ACLOCAL_ARGS = -Im4 --install --force
DEB_AUTOMAKE_ARGS = --add-missing --copy --foreign --force
DEB_MAKE_CLEAN_TARGET = distclean
makebuilddir::
	mkdir -p m4
clean::
	rm -rf m4
