#!/usr/bin/make -f

DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS := $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CC=$(DEB_HOST_GNU_TYPE)-gcc
LD=$(DEB_HOST_GNU_TYPE)-ld
export CC LD
endif

# librt only needed on kfreebsd
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
	LIBS := -lrt
endif

export CFLAGS
export LDFLAGS
export LIBS

%:
	dh $@ 

override_dh_fixperms:
	dh_fixperms --exclude mactelnetd.users
