#!/usr/bin/make -f

# Verbose build. See:
# http://qa.debian.org/bls/bytag/W-compiler-flags-hidden.html
export V=1

# Enable build hardening.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# Link-time optimisation demands knowledge about all CFLAGS both at
# compile time (as represented by CFLAGS and CXXFLAGS) but also at
# at link time.
#
# Adapted from
# http://anonscm.debian.org/cgit/pkg-boinc/boinc.git/tree/debian/rules
ifeq (,$(findstring nolto,$(DEB_BUILD_OPTIONS)))
 $(info I: Activating LinkTimeOptimisation)
 export CFLAGS += -flto
 export LDFLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
 export AR := gcc-ar
 export RANLIB := gcc-ranlib
endif

%:
	dh $@ --with autoreconf

# FIXME: remove the stuff after the || once we drop support for Jessie
override_dh_strip:
	dh_strip --dbgsym-migration libchealpix0-dbg || dh_strip
