changeset 12773:1fedbaac4fa9

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 ".".
author Jim Meyering <meyering@redhat.com>
date Sun, 24 Jan 2010 14:24:00 +0100
parents 2ea3e3fab7ee
children 2aa8f052c5aa
files ChangeLog top/maint.mk
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -45,12 +45,23 @@
 # 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