# HG changeset patch # User Jim Meyering # Date 1300274061 -3600 # Node ID dcc1567d7f4ee74614d72ecf153b3f7de2844a64 # Parent 012d0dca95b2294be2c5f4546a49f893d8430142 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-03-16 Jim Meyering + + 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. + 2011-03-13 Bruno Haible ignore-value tests: Avoid warnings. diff --git a/top/maint.mk b/top/maint.mk --- a/top/maint.mk +++ b/top/maint.mk @@ -57,11 +57,13 @@ # 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 @@ # 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 @@ \ : 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 \