#!/usr/bin/make -f
# -*- makefile -*-

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

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --with python3

override_dh_strip:
	dh_strip --dbgsym-migration='libsearpc-dbg (<< 3.0.8-3)'

override_dh_installchangelogs:
	dh_installchangelogs -XNEWS -XChangeLog

override_dh_install:
	mv $(CURDIR)/debian/tmp/usr/bin/searpc-codegen.py $(CURDIR)/debian/tmp/usr/bin/searpc-codegen
	sed -e '1 s/python/python3/' -i $(CURDIR)/debian/tmp/usr/bin/searpc-codegen
	help2man -n "generate function signatures and marshals for using Searpc" -N --version-string=$(DEB_VERSION_UPSTREAM) $(CURDIR)/debian/tmp/usr/bin/searpc-codegen > $(CURDIR)/debian/searpc-codegen.1
	dh_install -X.la -X.pyc -X.pyo --fail-missing
