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

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

# 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 = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

override_dh_auto_configure:
	cp -f /usr/share/misc/config.guess .
	cp -f /usr/share/misc/config.sub .
	CFLAGS="$(CFLAGS)" dh_auto_configure -- \
	       --with-html-dir=\$${prefix}/share/doc/enca/html \
	       --libexecdir=\$${prefix}/lib \
	       --with-librecode \
	       --with-libiconv \
		   --disable-static \
	       --disable-rpath

override_dh_strip:
	dh_strip --dbg-package=libenca-dbg

build:
	dh build

clean:
	dh clean

install: build
	dh install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do here

# Build architecture-dependent files here.
binary-arch: build install
	dh binary-arch

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
