#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS= hardening=+all

%:
	dh $@ --buildsystem=lua --with lua

generate_install_links:
# See top part of init.lua,
# readline.so is required to enable tab-completion functionality
# of trepl, however the object file readline.* is compiled into
# treplutils.so, so we link treplutils.so to readline.so, or
# the tab-completion will be broken.
	echo "usr/lib/$(DEB_HOST_MULTIARCH)/lua/5.1/treplutils.so usr/lib/$(DEB_HOST_MULTIARCH)/lua/5.1/readline.so" \
		> debian/lua-torch-trepl.links

override_dh_auto_configure: generate_install_links
	ln -s . trepl
	dh_auto_configure

override_dh_auto_clean:
	-$(RM) -rf 5.1-torch-trepl 5.2-torch-trepl debian/trash trepl
	dh_auto_clean
