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

QMAKE = qmake


DEB_BUILD_OPTIONS_PARALLEL ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))

ifeq "$(DEB_BUILD_OPTIONS_PARALLEL)" ""
    PARALLEL_MAKEFLAGS = "-j4"
endif

configure: configure-stamp

configure-stamp:
	dh_testdir
	$(QMAKE) -r INSTALL_PREFIX=/opt/raamattu

build: build-stamp

build-stamp: configure-stamp
	dh_testdir
	$(MAKE) $(PARALLEL_MAKEFLAGS)

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	$(MAKE) distclean || true

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_installdirs

	INSTALL_ROOT=$(CURDIR)/debian/tmp $(MAKE) install


# Build architecture-independent files here.
binary-indep: install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_install --sourcedir=debian/tmp
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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