#!/usr/bin/make -f

export DH_VERBOSE=2

%:
	dh $@ --with python2 --buildsystem=pybuild

override_dh_auto_clean:
	rm -rf $(CURDIR)/rekall-agent/rekall_agent/message_data
	rm -rf $(CURDIR)/rekall-agent/rekall_agent/test_data
	dh_auto_clean -- --dir=$(CURDIR)/rekall-core
	dh_auto_clean -- --dir=$(CURDIR)/rekall-agent

override_dh_auto_build:
	cp -rv $(CURDIR)/rekall-agent/messages $(CURDIR)/rekall-agent/rekall_agent/message_data
	cp -rv $(CURDIR)/rekall-agent/test_data $(CURDIR)/rekall-agent/rekall_agent
	$(patsubst override_%,%,$@) -- --dir=$(CURDIR)/rekall-core
	$(patsubst override_%,%,$@) -- --dir=$(CURDIR)/rekall-agent

override_dh_auto_configure \
override_dh_auto_install:
	$(patsubst override_%,%,$@) -- --dir=$(CURDIR)/rekall-core
	$(patsubst override_%,%,$@) -- --dir=$(CURDIR)/rekall-agent

override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="cd {build_dir}/rekall; \
	                   python{version} addrspace_test.py; \
	                   python{version} obj_test.py; \
	                   python{version} plugins/common/profile_index_test.py; \
	                   python{version} plugins/tools/profile_tool_test.py; \
	                   python{version} plugins/tools/yara_support_test.py; \
	                   python{version} testlib.py" \
	  dh_auto_test --

override_dh_strip:
	dh_strip --exclude=ffi --exclude=/usr/tools/

override_dh_install:
	dh_install --list-missing

make_man:
	help2man -N -i debian/extra_man.txt  -h '' --version-string="1.6.0" 'rekall -h | tail -n +34' > debian/rekall.1