#!/usr/bin/make -f

DH_AUTO_OPTIONS := -v -Smakefile --parallel
DESTDIR         := $(CURDIR)/debian/$(shell dh_listpackages)
export CFLAGS   := $(shell dpkg-buildflags --get CFLAGS) $(shell getconf LFS_CFLAGS) -Wall -Wextra

include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  export CC := $(DEB_HOST_GNU_TYPE)-gcc
else
  export CC := gcc
endif

%:
	dh "$@"

override_dh_auto_build:
	dh_auto_build $(DH_AUTO_OPTIONS) -- \
	                STRIP=: CFLAGS="$(CFLAGS)" CC=$(CC)

override_dh_auto_clean:
	dh_auto_clean $(DH_AUTO_OPTIONS)
	
override_dh_auto_install:	
	dh_auto_install $(DH_AUTO_OPTIONS) --destdir="$(DESTDIR)" -- \
	                STRIP=: CFLAGS="$(CFLAGS)" CC=$(CC)

