diff top/maint.mk @ 13208:85be704c72eb

maint.mk: print the elapsed time for each syntax-check rule * top/maint.mk (sc_m_rules_): Save start time in a file. (sc_z_rules_): New rules: remove temp file and print elapsed time. (local-check): Interpose the .z rules
author Jim Meyering <meyering@redhat.com>
date Sun, 11 Apr 2010 10:26:52 +0200
parents d6fb1e50d8db
children 473dffe238d2
line wrap: on
line diff
--- a/top/maint.mk	Sun Apr 11 10:37:31 2010 +0200
+++ b/top/maint.mk	Sun Apr 11 10:26:52 2010 +0200
@@ -129,8 +129,23 @@
 .PHONY: $(sc_m_rules_)
 $(sc_m_rules_):
 	@echo $(patsubst sc_%.m, %, $@)
+	@date +%s.%N > .sc-start-$(basename $@)
 
-local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available))
+# Compute and print the elapsed time for each syntax-check rule.
+sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules))
+.PHONY: $(sc_z_rules_)
+$(sc_z_rules_): %.z: %
+	@end=$$(date +%s.%N);						\
+	start=$$(cat .sc-start-$*);					\
+	rm -f .sc-start-$*;						\
+	awk -v s=$$start -v e=$$end					\
+	  'END {printf "%.2f: $* done\n", e - s}' < /dev/null
+
+# The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
+# that computes and prints elapsed time.
+local-check :=								\
+  $(patsubst sc_%, sc_%.z,						\
+    $(filter-out $(local-checks-to-skip), $(local-checks-available)))
 
 syntax-check: $(local-check)
 #	@grep -nE '#  *include <(limits|std(def|arg|bool))\.h>'		\