#!/usr/bin/make -f

LDFLAGS+=-Wl,--as-needed

ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	SUBSTVARS = -Vdist:Depends="gksu"
else
	SUBSTVARS = -Vdist:Depends=""
endif

%:
	dh $@ --with autotools_dev

override_dh_auto_test:
override_dh_gencontrol:
	dh_gencontrol -- $(SUBSTVARS)

override_dh_install:
	dh_install -plibddccontrol-dev
	# Strip wrong #include "config.h" from ddcci.h (bug#518083)
	cd debian/libddccontrol-dev/usr/include/ddccontrol/ && \
		grep -v '#include "config.h"' ddcci.h > ddcci.h.new && \
		mv ddcci.h.new ddcci.h
	dh_install --remaining-packages
