#!/usr/bin/make -f
export DH_VERBOSE=1

PERLARCHLIB := $(shell perl -MConfig -e 'print substr($$Config{vendorarch}, 1);')

BUILDOPTS= --with-cluster --without-forester --with-kinwalker --disable-silent-rules

ifeq ($(shell lsb_release --short --codename),wheezy)
BUILDOPTS+= --disable-lto --without-rnalocmin
endif

ifeq ($(shell lsb_release --short --codename),precise)
BUILDOPTS+= --disable-lto --without-rnalocmin
endif

ifeq ($(shell lsb_release --short --codename),focal)
HELPEROPTS= --with python3
else
HELPEROPTS= --with python2,python3
endif

%:
	dh $@ --parallel $(HELPEROPTS)

override_dh_auto_configure:
	dh_auto_configure --  $(BUILDOPTS) INSTALLDIRS=vendor
	sed -e 's,@PERLARCHLIB@,$(PERLARCHLIB),g' debian/perl-rna.install.in > debian/perl-rna.install

override_dh_strip:
	dh_strip --exclude=libRNA.a

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build .*egg-info

override_dh_clean:
	rm -f debian/perl-rna.install
	dh_clean
 
