#!/usr/bin/make -f
# debhelper rules file for hexer.

# Aim for the top, adapt if anything should break on the buildds.
DEB_BUILD_MAINT_OPTIONS=	hardening=+all
export DEB_BUILD_MAINT_OPTIONS

DEB_CFLAGS_MAINT_APPEND=	-pipe -std=c99 \
		-Wall -W -std=c99 -pedantic -Wbad-function-cast \
		-Wcast-align -Wcast-qual -Winline \
		-Wmissing-prototypes -Wnested-externs \
		-Wredundant-decls -Wstrict-prototypes -Wwrite-strings
DEB_CPPFLAGS_MAINT_APPEND=	-DHE_DEFAULT_PAGER=\"pager\"
export DEB_CPPFLAGS_MAINT_APPEND DEB_CFLAGS_MAINT_APPEND

DEB_BUILD_ARCH:=	$(shell dpkg-architecture -qDEB_HOST_ARCH)

ifneq (,$(findstring kfreebsd,$(DEB_BUILD_ARCH)))
	DEB_CPPFLAGS_MAINT_APPEND+=	-DBSD
endif
ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
	DEB_CFLAGS_MAINT_APPEND+=	-Werror
endif

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

override_dh_auto_configure:
	cp -f config.linux config.h

override_dh_auto_install:
	dh_auto_install -- PREFIX=/usr MANDIR=/usr/share/man/man1

%:
	dh $@ --parallel
