diff options
Diffstat (limited to 'doc/Makefile.am')
-rw-r--r-- | doc/Makefile.am | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am index 9d6997c78..cba333226 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -50,13 +50,14 @@ syntax_checks = \ sc-avoid-timezone \ sc-avoid-zeroes \ sc-exponent-grouping \ + sc-lower-case-var \ sc-use-small-caps-NUL .PHONY: $(syntax_checks) check-texinfo # List words/regexps here that should not appear in the texinfo documentation. check-texinfo: $(syntax_checks) - fail=0; \ + @fail=0; \ grep '@url{' $(srcdir)/*.texi && fail=1; \ grep '\$$@"' $(srcdir)/*.texi && fail=1; \ grep -n '[^[:punct:]]@footnote' $(srcdir)/*.texi && fail=1; \ @@ -73,27 +74,45 @@ check-texinfo: $(syntax_checks) # Use `time zone', not `timezone'. sc-avoid-timezone: - $(EGREP) timezone $(srcdir)/*.texi && exit 1 || : + @$(EGREP) timezone $(srcdir)/*.texi && exit 1 || : # Check for insufficient exponent grouping, e.g., # @math{2^64} should be @math{2^{64}}. sc-exponent-grouping: - $(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || : + @$(EGREP) '\{.*\^[0-9][0-9]' $(srcdir)/*.texi && exit 1 || : # E.g., use @sc{nul}, not NUL. sc-use-small-caps-NUL: - $(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || : + @$(EGREP) '$(_W)NUL$(W_)' $(srcdir)/*.texi && exit 1 || : # Say I/O, not IO. sc-avoid-io: - $(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || : + @$(EGREP) '$(_W)IO$(W_)' $(srcdir)/*.texi && exit 1 || : # I prefer nonzero over non-zero. sc-avoid-non-zero: - $(EGREP) non-zero $(srcdir)/*.texi && exit 1 || : + @$(EGREP) non-zero $(srcdir)/*.texi && exit 1 || : # Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent). sc-avoid-zeroes: - $(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || : + @$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || : + +# ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +ME = doc/Makefile + +# The quantity inside @var{...} should not contain upper case letters. +# The leading backslash exemption is to permit in-macro uses like +# @var{\varName\} where the upper case letter is part of a parameter name. +find_upper_case_var = \ + '/\@var{/ or next; \ + while (/\@var{(.+?)}/g) \ + { \ + $$v = $$1; \ + $$v =~ /[A-Z]/ && $$v !~ /^\\/ and (print "$$ARGV:$$.:$$_"), $$m = 1 \ + } \ + END {$$m and (warn "$(ME): do not use upper case in \@var{...}\n"), exit 1}' +sc-lower-case-var: + @$(PERL) -e 1 2> /dev/null && \ + $(PERL) -lne $(find_upper_case_var) $(srcdir)/*.texi check: check-texinfo |