Remove m4/warning.m4.
[gnulib.git] / top / maint.mk
index 4d74e19..62f3a41 100644 (file)
@@ -2,7 +2,7 @@
 # This Makefile fragment is intended to be useful by any GNU-like project.
 # This file originate from coreutils, CPPI, Bison, and Autoconf.
 
-# Copyright (C) 2001-2007 Free Software Foundation, Inc.
+# Copyright (C) 2001-2008 Free Software Foundation, Inc.
 #
 # 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
@@ -21,10 +21,10 @@ ME := maint.mk
 
 # List of all C-like source code files that will be tested for
 # stylistic "errors".  You may want to define this to something
-# more complex in Makefile.cfg.
+# more complex in cfg.mk.
 C_SOURCES ?= $(shell find . -name '*.[chly]')
 
-# Add some more files to check, typically set in Makefile.cfg.
+# Add some more files to check, typically set in cfg.mk.
 C_SOURCES += $(C_SOURCES_ADD)
 
 # Do not save the original name or timestamp in the .tar.gz file.
@@ -105,6 +105,30 @@ syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(ME))
 
 syntax-check: $(syntax-check-rules)
 
+# Code Coverage
+
+init-coverage:
+       make clean
+       lcov --directory . --zerocounters
+
+COVERAGE_CCOPTS ?= "-g --coverage"
+COVERAGE_OUT ?= doc/coverage
+
+build-coverage:
+       make CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS)
+       make CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
+       mkdir -p $(COVERAGE_OUT)
+       lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
+               --capture
+
+gen-coverage:
+       genhtml --output-directory $(COVERAGE_OUT) \
+               $(COVERAGE_OUT)/$(PACKAGE).info \
+               --highlight --frames --legend \
+               --title "$(PACKAGE_NAME)"
+
+coverage: init-coverage build-coverage gen-coverage
+
 # Update gettext files.
 PACKAGE ?= $(shell basename $(PWD))
 POURL = http://translationproject.org/latest/$(PACKAGE)/