#!/usr/bin/make -f

#export DH_VERBOSE=1

PACKAGE	 = jwm

include debian/debian-vars.mk
include debian/debian-autotools.mk

override_dh_auto_configure:
	CFLAGS="$(CFLAGS)" ./configure \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc/jwm

install: build
	# target: install
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	#  Install binary
	$(INSTALL_DIR) $(BINDIR)
	$(INSTALL_BIN) src/$(PACKAGE) $(BINDIR)

	#  Install GDM support
	$(INSTALL_DIR) $(XSESSIONDIR)
	$(INSTALL_DATA) debian/*.desktop $(XSESSIONDIR)

	#  Install poweroff program
	$(INSTALL_DIR) $(LIBDIR)
	$(INSTALL_SCRIPT) debian/jwm-poweroff.sh $(LIBDIR)

binary-arch: build install
	# target: binary-arch -- Build architecture-dependent files
	# Clean up for diff. Not included in upstream source 2.0.1+
	rm -f config.guess config.sub

	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_install
	dh_installmenu
	dh_installman
	dh_installwm --priority=80 jwm
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch

%:
	dh $@

.PHONY: install
.PHONY: binary-arch binary

# End of file
