#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS += -Wall
ifneq ($(findstring debug,$(DEB_BUILD_OPTIONS)),)
CFLAGS += -g
endif

clean:
	dh_testdir
	dh_testroot
	-rm -rf *-stamp
	dh_clean
	$(MAKE) clean

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	> $@

binary: binary-arch binary-indep

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs usr/bin
	install otp debian/otp/usr/bin
	dh_installdocs README
	dh_installman otp.1
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep: build

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