# Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# Licensed under the Academic Free License version 2.1
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Alternatively, at your option, you can redistribute and/or modify
# this single file under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1 of
# that license, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

lcov-reset:
	lcov --directory @top_srcdir@ --zerocounters

lcov-report:
	lcov --directory @top_srcdir@ --capture \
		--output-file @top_builddir@/lcov.info.tmp
	lcov --directory @top_srcdir@ --output-file @top_builddir@/lcov.info \
		--remove @top_builddir@/lcov.info.tmp '*-scan.c'
	rm @top_builddir@/lcov.info.tmp
	$(mkdir_p) @top_builddir@/lcov.html
	git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
	genhtml --title "@PACKAGE_STRING@ $$git_commit" \
		--output-directory @top_builddir@/lcov.html lcov.info
	@echo
	@echo 'lcov report can be found in:'
	@echo 'file://@abs_top_builddir@/lcov.html/index.html'
	@echo

lcov-check:
	$(MAKE) lcov-reset
	$(MAKE) check $(LCOV_CHECK_ARGS)
	$(MAKE) lcov-report

## vim:set ft=automake:
