diff options
author | Jim Meyering <meyering@redhat.com> | 2011-03-16 12:14:21 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-03-16 12:14:21 +0100 |
commit | 0baae9cadd08c9704e3c704dd69fb75640293e9d (patch) | |
tree | 3da5d91d6868fb01b5850a487e97cbc8faf91373 /top | |
parent | 235131bfe7593a71a35535221883f6e244408de0 (diff) | |
download | gnulib-0baae9cadd08c9704e3c704dd69fb75640293e9d.tar.gz |
maint.mk: allow fine-grained syntax-check exclusion via Make variables
Before, you would have had to create one .x-sc_ file per rule in order
to exempt offending files. Now, you may instead use a Make variable --
usually defined in cfg.mk -- whose name identifies the affected rule.
* top/maint.mk (_sc_excl): Define.
(VC_LIST_EXCEPT): Use it to exclude names on a per-rule basis.
(_sc_search_regexp): When not using VC_LIST_EXCEPT, exclude here, too.
Diffstat (limited to 'top')
-rw-r--r-- | top/maint.mk | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/top/maint.mk b/top/maint.mk index 303e9c12fd..1df8c7a770 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -57,11 +57,13 @@ endif # In order to be able to consistently filter "."-relative names, # (i.e., with no $(srcdir) prefix), this definition is careful to # remove any $(srcdir) prefix, and to restore what it removes. +_sc_excl = \ + $(if $(exclude_file_name_regexp--$@),$(exclude_file_name_regexp--$@),^$$) VC_LIST_EXCEPT = \ $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \ | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \ else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \ - | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \ + | grep -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \ $(_prepend_srcdir_prefix) ifeq ($(origin prev_version_file), undefined) @@ -196,6 +198,16 @@ syntax-check: $(local-check) # halt # # Message to display before to halting execution. +# +# Finally, you may exempt files based on an ERE matching file names. +# For example, to exempt from the sc_space_tab check all files with the +# .diff suffix, set this Make variable: +# +# exclude_file_name_regexp--sc_space_tab = \.diff$ +# +# Note that while this functionality is mostly inherited via VC_LIST_EXCEPT, +# when filtering by name via in_files, we explicitly filter out matching +# names here as well. # By default, _sc_search_regexp does not ignore case. export ignore_case = @@ -233,7 +245,8 @@ define _sc_search_regexp \ : Filter by file name; \ if test -n "$$in_files"; then \ - files=$$(find $(srcdir) | grep -E "$$in_files"); \ + files=$$(find $(srcdir) | grep -E "$$in_files" \ + | grep -Ev '$(exclude_file_name_regexp--$@)'); \ else \ files=$$($(VC_LIST_EXCEPT)); \ if test -n "$$in_vc_files"; then \ |