#!/usr/bin/make -f

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

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	export DEB_CFLAGS_MAINT_APPEND:=-Wall
else
	export DEB_CFLAGS_MAINT_APPEND:=-Wall -ffunction-sections
endif

export DEB_LDFLAGS_MAINT_APPEND:=-Wl,--as-needed

# If set to a true value then MakeMaker's prompt function will
# always return the default without waiting for user input.
export PERL_MM_USE_DEFAULT=1

PACKAGE=$(shell dh_listpackages)

# NetCDF >= 4.3.3.1 uses Multi-Arch path
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export NETCDF_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)

%:
	dh $@ --parallel

override_dh_auto_build:
	LD_RUN_PATH="" dh_auto_build

override_dh_auto_test:
	TEST_VERBOSE=1 DISPLAY="" dh_auto_test

override_dh_install:
	dh_install --list-missing

override_dh_installdocs:
	dh_installdocs README

override_dh_installchangelogs:
	dh_installchangelogs Changes

override_dh_perl:
	dh_perl
	dh_pdl

