#!/usr/bin/make -f

# Package name, source dir and target installation dir.
PACKAGE=msp430mcu
DESTDIR=$(CURDIR)/debian/$(PACKAGE)/usr

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

build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp unpack-stamp patch-stamp
	rm -rf $(DESTDIR)
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	MSP430_ROOT=$(CURDIR) scripts/install.sh $(DESTDIR)
	
	# Fix C headers and spec permissions
	chmod a-x $(DESTDIR)/msp430/include/*.h \
		  $(DESTDIR)/msp430/lib/*.spec 

binary-arch: binary-indep

binary-indep: install
	dh_testdir
	dh_testroot
	dh_installdocs -n
	dh_installman
	dh_installchangelogs
	dh_lintian
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep
.PHONY: build clean binary-indep binary-arch binary install configure
