#!/usr/bin/make -f
#

# Enable Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# This has to be exported to make some magic below work.
export DH_OPTIONS

install_dir = debian/tmp


%:
	dh $@ --with python2

override_dh_auto_build:

	make replay;

	set -ex; for python in $(shell pyversions -r); do \
		cd ioprofiler; \
		$$python setup.py build; \
		cd .. ; \
	done;

override_dh_auto_install:

	mkdir -p $(install_dir)/usr/bin
	mkdir -p $(install_dir)/usr/share/man/man1

	install ioreplay $(install_dir)/usr/bin/
	install man/ioreplay.1 $(install_dir)/usr/share/man/man1/
	install ioprofiler-trace $(install_dir)/usr/bin/

	set -ex; for python in $(shell pyversions -r); do \
		cd ioprofiler && $$python setup.py install --prefix=/usr --no-compile --root=$(CURDIR)/$(install_dir) --install-layout=deb; \
	done;
