#!/usr/bin/make -f

#export DH_VERBOSE=1

# The main package; matomo-vanilla-logfile has no files of its own to prepare.
d = debian/matomo-vanilla

%:
	dh $@

build: build-stamp
build-stamp:
	@rm -f debian/files
	@dh_testdir

clean:
	@dh_testdir
	@dh_testroot
	@dh_prep
	@$(MAKE) clean

install: build
	@dh_testdir
	@dh_testroot
	@dh_prep
	@dh_installdirs
	@$(MAKE) checkfetch DESTDIR=$(CURDIR)/$d
	@$(MAKE) cleanup DESTDIR=$(CURDIR)/$d
	@$(MAKE) checkmatomoinstall DESTDIR=$(CURDIR)/$d
	@$(MAKE) checkmatomorootdir DESTDIR=$(CURDIR)/$d
	@dh_install
	@dh_lintian
	@dh_link


# build architecture-independent files
binary-indep: build install
	@dh_testdir
	@dh_testroot
	@dh_installdirs -i
	@dh_install -i
	@dh_installsystemd -p matomo-vanilla --no-enable --no-start matomo.timer
	@dh_installchangelogs
	@dh_installdocs
	@dh_installdebconf
	@dh_compress
	@dh_link
	@dh_fixperms
	@$(MAKE) fixperms DESTDIR=$(CURDIR)/$d
	@$(MAKE) checklintianlic DESTDIR=$(CURDIR)/$d
	@$(MAKE) checklintianextralibs DESTDIR=$(CURDIR)/$d
	@dh_installdeb
	@dh_gencontrol
	@dh_md5sums
	@dh_builddeb

# build architecture-dependent files
binary-arch: build install

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