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

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

# For DEB_VERSION_UPSTREAM
include /usr/share/dpkg/pkg-info.mk

# Get version information
UPVER := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -re 's/\+dfsg-.*//')
LVER = $(shell echo $(UPVER) | sed -nre 's/([0-9]+)\..*/\1/p')
LSUBVER = $(shell echo $(UPVER) | sed -nre 's/[0-9]\.([0-9]+).*/\1/p')
# Version information is needed by the build process
export LVER
export LSUBVER

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    DEB_CFLAGS_MAINT_APPEND += -O0
else
    DEB_CFLAGS_MAINT_APPEND += -O3
ifeq (amd64,$(DEB_HOST_ARCH))
    DEB_CFLAGS_MAINT_APPEND += -msse
endif
endif

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)


%:
	dh $@


override_dh_auto_install:
	dh_auto_install -- libdir=/usr/lib/$(DEB_HOST_MULTIARCH)/
