Subject: [PATCH 3/5] Makefile: add check target using fontlint

From: Jan Pokorný <[email-masked]>
Date: Mon, 20 Feb 2012 11:34:46 +0100

Fontlint is a font checker accompanying FontForge.
The check will proceed the SFD files through it, outputting the messages
to both standard output and to the per commit specific file (failback
to per date specific if git information not available) for easy
regression checking.  This final part of "check" workflow can be done,
e.g., manually (with diff selecting the right files to compare).

To prevent logs from check messing the repo, capture them in local
.gitignore file that initially includes also archives and directory
with generated TTF files.

Signed-off-by: Jan Pokorný <[email-masked]>
---
 source/.gitignore |    7 +++++++
 source/Makefile   |   12 +++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100644 source/.gitignore

diff --git a/source/.gitignore b/source/.gitignore
new file mode 100644
index 0000000..0615b11
--- /dev/null
+++ b/source/.gitignore
@@ -0,0 +1,7 @@
+# archives (this dir only)
+/*.tar.gz
+/*.zip
+# generated subdirectories
+/liberation-fonts-ttf-*/
+# logs from check
+/check_*
diff --git a/source/Makefile b/source/Makefile
index eb53799..ff28e79 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -1,11 +1,13 @@
 VER = 1.07.2
 #VER = 1.06.0.$(shell date +%Y%m%d)
 FONTFORGE = fontforge
+FONTLINT = fontlint
 
 TMPDIR := $(shell mktemp -d)
 SFDFILES := src/LiberationMono-Bold.sfd src/LiberationMono-BoldItalic.sfd src/LiberationMono-Italic.sfd src/LiberationMono-Regular.sfd src/LiberationSans-Bold.sfd src/LiberationSans-BoldItalic.sfd src/LiberationSans-Italic.sfd src/LiberationSans-Regular.sfd src/LiberationSerif-Bold.sfd src/LiberationSerif-BoldItalic.sfd src/LiberationSerif-Italic.sfd src/LiberationSerif-Regular.sfd src/LiberationSansNarrow-Regular.sfd src/LiberationSansNarrow-Bold.sfd src/LiberationSansNarrow-Italic.sfd src/LiberationSansNarrow-BoldItalic.sfd
 SCRIPTS := scripts/sfd2ttf.pe scripts/ttf2sfd.pe
 MISCFILES := AUTHORS ChangeLog COPYING License.txt README TODO
+CHECK_PREFIX = check
 
 all: build
 
@@ -31,7 +33,15 @@ dist-ttf: clean-ttf build
 	tar czvhf liberation-fonts-ttf-$(VER).tar.gz liberation-fonts-ttf-$(VER)/
 #	zip -j liberation-fonts-ttf-$(VER).zip liberation-fonts-ttf-$(VER)/*
 	rm -rf liberation-fonts-ttf-$(VER)
+
+check:
+	log="$(CHECK_PREFIX)_$$(git describe --dirty --always 2>/dev/null||date +%Y%m%d)" \
+	  && for sfd in $(SFDFILES); do \
+	         $(FONTLINT) $${sfd} 2>/dev/null | tee -a $${log}; echo; \
+	     done
+
 clean: clean-ttf clean-src
+	rm -f $(CHECK_PREFIX)_*
 
 clean-ttf:
 	rm -rf liberation-fonts-*
@@ -39,4 +49,4 @@ clean-ttf:
 clean-src:
 	rm -f *.tar.gz
 
-.PHONY: all build dist dist-src dist-sfd dist-ttf clean clean-ttf clean-src
+.PHONY: all build dist dist-src dist-sfd dist-ttf check clean clean-ttf clean-src
-- 
1.7.3.4