#!/usr/bin/make -f

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

build: build-stamp
build-stamp:
	dh_testdir

	chmod +x app/tools/halibut/charset/sbcsgen.pl

	(cd app ; $(MAKE) )

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	(cd app ; $(MAKE) clean )
	rm -f build-stamp
	dh_clean

binary-indep: build

binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	cp -r app/lib/* debian/xtrkcad/usr/lib/xtrkcad/
	chmod -x debian/xtrkcad/usr/lib/xtrkcad/logo.bmp
	cp app/doc/*.html debian/xtrkcad/usr/share/xtrkcad/html/
	cp -r app/doc/png.d debian/xtrkcad/usr/share/xtrkcad/html/
	ln -s ../../share/xtrkcad/html debian/xtrkcad/usr/lib/xtrkcad/html
	cp app/bin/xtrkcad app/help/xtrkcad.tip \
		debian/xtrkcad/usr/lib/xtrkcad/
	/usr/bin/install -c -m 755 debian/wrapper.sh \
		debian/xtrkcad/usr/bin/xtrkcad
	rm -f debian/xtrkcad/usr/lib/xtrkcad/COPYING
	dh_installdocs 
	dh_installmenu
	dh_installcron
	dh_installman debian/xtrkcad.1
	dh_installchangelogs
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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