#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# enable hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CXXFLAGS+=$(CPPFLAGS)

# Support parallel build
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
   MAKEFLAGS += -j$(NUMJOBS)
endif

%:
	dh $@ --with autoreconf

override_dh_autoreconf:
	cp tools/solarpowerlog.init debian/
	cp tools/solarpowerlog.default debian/
	# needed when building directly from the git repository.
	# otherwise some files are missing.
	dh_autoreconf ./bootstrap.sh

override_dh_clean:
	dh_clean
	rm -f debian/solarpowerlog.init debian/solarpowerlog.default
	rm -f config/ltmain.sh m4/libtool.m4


override_dh_installdocs:
	# do not install the GPL / LGPL license files
	rm -f  debian/solarpowerlog/usr/share/doc/solarpowerlog/*GPL*
	dh_installdocs -X GPL
