]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
make "make syntax-check" consistent with "git diff --check"
authorJim Meyering <meyering@redhat.com>
Thu, 16 Jul 2009 07:06:58 +0000 (09:06 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 16 Jul 2009 13:06:42 +0000 (15:06 +0200)
This makes "make syntax-check" fail when a version-controlled
file contains a trailing blank line.
* cfg.mk (sc_prohibit_trailing_blank_lines): New rule.

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 3b3d57f492abb6c7e459ebfeefc9e83951b064d0..0bf935d51a7f504448326a288c9eec72e3605a2a 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -228,6 +228,15 @@ sc_libvirt_unmarked_diagnostics:
          { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
 
+# Disallow trailing blank lines.
+sc_prohibit_trailing_blank_lines:
+       @$(VC_LIST_EXCEPT) | xargs perl -ln -0777 -e                    \
+         '/\n\n+$$/ and print $$ARGV' > $@-t
+       @found=0; test -s $@-t && { found=1; cat $@-t 1>&2;             \
+         echo '$(ME): found trailing blank line(s)' 1>&2; };           \
+       rm -f $@-t;                                                     \
+       test $$found = 0
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null