>From 0faa93991f6e835ae7eaa66e4367991402db32ca Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Mon, 17 Aug 2015 22:30:04 +0200 Subject: [PATCH] maint: add syntax check to ensure larger man/*.x files have a Copyright * cfg.mk (sc_man_check_x_copyright): Add rule to ensure that non-trivial .x files in the 'man/' subdirectory, i.e., files exceeding a line count of 20 or a byte count of 1000, contain a proper Copyright notice. --- cfg.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cfg.mk b/cfg.mk index dedb7ac..67f5ae7 100644 --- a/cfg.mk +++ b/cfg.mk @@ -293,6 +293,21 @@ check-x-vs-1: | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \ rm $$t +# Ensure that non-trivial .x files in the 'man/' subdirectory, +# i.e., files exceeding a line count of 20 or a byte count of 1000, +# contain a Copyright notice. +.PHONY: sc_man_check_x_copyright +sc_man_check_x_copyright: + @t=$@-t; \ + cd $(srcdir) && wc -cl man/*.x | head -n-1 \ + | awk '$$1 >= 20 || $$2 >= 1000 {print $$3}' \ + | $(ASSORT) > $$t; \ + xargs grep -l 'Copyright .* Free Software Foundation' < $$t \ + | $(ASSORT) -u | diff - $$t \ + || { echo 1>&2 '$@: exceeding file size/line count limit' \ + '- please add a copyright note'; rm $$t; exit 1; }; \ + rm $$t + # Writing a portable rule to generate a manpage like '[.1' would be # a nightmare, so filter that out. all-progs-but-lbracket = $(filter-out [,$(patsubst src/%,%,$(all_programs))) -- 2.1.4