Generate "gadict article count" statistic in RST format.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 15 Jan 2012 20:12:01 +0200
changeset 128 ca6ceff4941c
parent 127 2fc0561f80ca
child 131 1bcce07aabf5
Generate "gadict article count" statistic in RST format.
.hgignore
Makefile
--- a/.hgignore	Sun Jan 15 19:40:15 2012 +0200
+++ b/.hgignore	Sun Jan 15 20:12:01 2012 +0200
@@ -1,6 +1,7 @@
 syntax: glob
 
 VERSION*
+STAT.rst
 *.dict
 *.dict.dz
 *.index
--- a/Makefile	Sun Jan 15 19:40:15 2012 +0200
+++ b/Makefile	Sun Jan 15 20:12:01 2012 +0200
@@ -318,14 +318,30 @@
 sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPT)
 
 .PHONY: stat
-stat:
-	total=0; \
-	for dic in *.dict-c5; do \
-		cnt=`grep '^_____' $$dic | wc -l`; \
-		echo $$dic 'has  ' $$cnt words.; \
-		total=$$(($$total + $$cnt)); \
-	done; \
-	echo Total words count is $$total.
+stat: STAT.rst
+
+STAT.rst: $(C5_FILES) $(BUILD_SCRIPT)
+	{ \
+echo '============================'; \
+echo ' gadict project statistics.'; \
+echo '============================'; \
+echo '.. contents::'; \
+echo; \
+echo 'gadict article count.'; \
+echo '====================='; \
+echo; \
+echo '======================================== ====='; \
+echo '             Dictionary                  Count'; \
+echo '======================================== ====='; \
+total=0; \
+for dic in $(C5_FILES); do \
+  cnt=`grep '^_____' $$dic | wc -l`; \
+  printf '%40s %5s\n' $$dic $$cnt; \
+  total=$$(($$total + $$cnt)); \
+done; \
+printf '%40s %5s\n' '**Total**' $$total; \
+echo '======================================== ====='; \
+} >$@
 
 ################################################################
 # Clean targets.
@@ -336,7 +352,7 @@
 
 .PHONY: clean
 clean:
-	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES)
+	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) STAT.rst
 	rm -rf $(DIST_DIR) $(DIST_TARBALLS)
 	rm -rf $(DISTSRC_DIR) $(DISTSRC_TARBALLS)