#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CPPFLAGS_MAINT_APPEND = -DVERSION=\\\"$(DEB_VERSION_UPSTREAM)\\\" -DGLOBAL_CONF=\\\"/etc/onddirrc\\\"

include /usr/share/dpkg/buildtools.mk
CFLAGS_FOR_MAKEFILE=$(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS_FOR_MAKEFILE=$(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- CC='$(CC)' LD='$(CC)' CFLAGS='$(CFLAGS_FOR_MAKEFILE)' LDFLAGS='$(LDFLAGS_FOR_MAKEFILE)'

override_dh_auto_install:
	dh_auto_install -- CC='$(CC)' LD='$(CC)' CFLAGS='$(CFLAGS_FOR_MAKEFILE)' LDFLAGS='$(LDFLAGS_FOR_MAKEFILE)'

override_dh_fixperms:
	dh_fixperms
	@# Remove the executable flag from files installed there, since
	@# they are supposed to be sourced.
	chmod a-x debian/ondir/usr/share/ondir/integration/*
