#!/usr/bin/make -f
# -*- makefile -*-

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

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f bin/fel-pio.* bin/*.sunxi bin/*.scr

override_dh_auto_build:
	dh_auto_build
	mkimage -A arm -T script -d bin/ramboot.uboot-sh bin/ramboot.scr

override_dh_auto_install: PKG := debian/sunxi-tools
override_dh_auto_install:
	dh_install
	install -m0755 usb-boot $(PKG)/usr/bin/sunxi-usb-boot
	install -m0755 fel $(PKG)/usr/bin/sunxi-fel
	install -m0755 fexc $(PKG)/usr/bin/sunxi-fexc
	install -m0755 bootinfo $(PKG)/usr/bin/sunxi-bootinfo

	ln -s sunxi-fexc $(PKG)/usr/bin/fex2bin
	ln -s sunxi-fexc $(PKG)/usr/bin/bin2fex
	install -m0644 bin/ramboot.scr $(PKG)/usr/share/sunxi-tools/ramboot.scr

	# To consider in the future:
	# nand-part:  armhf only
	# fel-pio:    debug/early bringup only
	# jtag-loop:  debug/early bringup only
	# fel-sdboot: potentially useful, but requires mksunxiboot
	# boot_head:  broken u-boot only
