maint.mk: do not prepend "./" after filtering
authorJim Meyering <meyering@redhat.com>
Sun, 24 Jan 2010 13:24:00 +0000 (14:24 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 24 Jan 2010 13:26:42 +0000 (14:26 +0100)
* top/maint.mk (_prepend_srcdir_prefix): New variable
(VC_LIST_EXCEPT): Use it to avoid prepending (post-filter)
"./" when $(srcdir) is ".".

ChangeLog
top/maint.mk

index 373a1bb..813ae48 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-01-24  Jim Meyering  <meyering@redhat.com>
 
+       maint.mk: do not prepend "./" after filtering
+       * top/maint.mk (_prepend_srcdir_prefix): New variable
+       (VC_LIST_EXCEPT): Use it to avoid prepending (post-filter)
+       "./" when $(srcdir) is ".".
+
        define STREQ(a,b) consistently, removing useless parentheses
        #define STREQ(a, b) (strcmp ((a), (b)) == 0) is over-parenthesized,
        since the only risk is that "a" or "b" contains an unparenthesized
index 314abc1..346d681 100644 (file)
@@ -45,12 +45,23 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
 # removes only the intended prefix.
 _dot_escaped_srcdir = $(subst .,\.,$(srcdir))
 
+# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
+# when $(srcdir) is not ".".
+ifeq ($(srcdir),.)
+_prepend_srcdir_prefix =
+else
+_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|'
+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.
 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)' \
-       | sed 's|^|$(srcdir)/|'
+       $(_prepend_srcdir_prefix)
 
 ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version