#!/usr/bin/make -f

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

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build:
	a2x -d manpage -f manpage man/pethtool.8.asciidoc
	a2x -d manpage -f manpage man/pifconfig.8.asciidoc

	# Make python2/3 versions of each file so packages won't conflict
	cp -p man/pethtool.8 man/pethtool3.8
	cp -p man/pifconfig.8 man/pifconfig3.8
	cp -p scripts/pethtool scripts/pethtool3
	cp -p scripts/pifconfig scripts/pifconfig3
	sed -i -e 's/python/python3/' scripts/pethtool3
	sed -i -e 's/python/python3/' scripts/pifconfig3

execute_after_dh_auto_install:
	# Remove original scripts, installed by setup.py. We will update-alternatives later
	rm -rf debian/python3-ethtool/usr/bin

override_dh_auto_test:

clean:
	rm -f \
	  man/pethtool.8 man/pifconfig.8 \
	  man/pethtool3.8 man/pifconfig3.8 \
	  scripts/pethtool3 scripts/pifconfig3
	rm -rf build ethtool.egg-info
