#
# Change it according to your setup
#
N2N_HOME=$(PWD)/../..
N2N_BUILD=${N2N_HOME}/packages/debian/n2n

all: clean pkg

pkg:
	cd ../..; make; cd -
	if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi
	mkdir -p ${N2N_BUILD}/usr/sbin ${N2N_BUILD}/usr/share/man/man1 ${N2N_BUILD}/usr/share/man/man7 ${N2N_BUILD}/usr/share/man/man8
	install -m755 ../../supernode ${N2N_BUILD}/usr/sbin/
	install -m755 ../../edge ${N2N_BUILD}/usr/sbin/
	install -m644 ../../edge.8.gz ${N2N_BUILD}/usr/share/man/man8/
	install -m644 ../../supernode.1.gz ${N2N_BUILD}/usr/share/man/man1/
	install -m644 ../../n2n.7.gz ${N2N_BUILD}/usr/share/man/man7/
	@/bin/rm -f ../n2n*.deb
	dpkg-buildpackage -rfakeroot -d -us -uc
	dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb
	@\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes
	@/bin/mv ../n2n_*deb .
	@echo
	@echo "Package built."
	@/bin/ls n2n_*deb
	@echo "-------------------------------"
	-dpkg -I n2n_*deb
	-dpkg --contents n2n_*deb
	@echo "-------------------------------"

distclean:
	echo "dummy distclean"

install:
	echo "dummy install"

clean:
	rm -rf *~ *deb
