changeset 13333:dd75a1afe536

maint.mk: avoid using a temporary file in the always-defined-macros check * top/maint.mk (.re-defmac): Remove rule. (gl_trap_): Remove definition. (sc_prohibit_always-defined_macros): Rewrite not to create and depend on a temporary file. Instead, depend on GNU grep's ability to read a list of regular expressions from stdin when given "-f -".
author Jim Meyering <meyering@redhat.com>
date Mon, 10 May 2010 09:29:09 +0200
parents 360961713a01
children e104effcede9
files ChangeLog top/maint.mk
diffstat 2 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 09 22:39:34 2010 +0200
+++ b/ChangeLog	Mon May 10 09:29:09 2010 +0200
@@ -1,3 +1,12 @@
+2010-05-10  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: avoid using a temporary file in the always-defined-macros check
+	* top/maint.mk (.re-defmac): Remove rule.
+	(gl_trap_): Remove definition.
+	(sc_prohibit_always-defined_macros): Rewrite not to create and
+	depend on a temporary file.  Instead, depend on GNU grep's ability
+	to read a list of regular expressions from stdin when given "-f -".
+
 2010-05-09  Bruno Haible  <bruno@clisp.org>
 
 	Update to GNU gettext 0.18.
--- a/top/maint.mk	Sun May 09 22:39:34 2010 +0200
+++ b/top/maint.mk	Mon May 10 09:29:09 2010 +0200
@@ -679,31 +679,24 @@
 
 # Create a list of regular expressions matching the names
 # of macros that are guaranteed to be defined by parts of gnulib.
-.re-defmac:
-	@gen_h=$(gl_generated_headers_);				\
+define def_sym_regex
+	gen_h=$(gl_generated_headers_);					\
 	(cd $(gnulib_dir)/lib;						\
 	  for f in *.in.h $(gl_other_headers_); do			\
 	    perl -lne '$(gl_extract_significant_defines_)' $$f;		\
 	  done;								\
 	) | sort -u							\
 	  | grep -Ev '^ATTRIBUTE_NORETURN'				\
-	  | sed 's/^/^ *# *define /;s/$$/\\>/'				\
-	  > $@-t
-	@mv $@-t $@
-
-define gl_trap_
-  Exit () { set +e; (exit $$1); exit $$1; };				\
-  for sig in 1 2 3 13 15; do						\
-    eval "trap 'Exit $$(expr $$sig + 128)' $$sig";			\
-  done
+	  | sed 's/^/^ *# *define /;s/$$/\\>/'
 endef
 
 # Don't define macros that we already get from gnulib header files.
-sc_prohibit_always-defined_macros: .re-defmac
+sc_prohibit_always-defined_macros:
 	@if test -d $(gnulib_dir); then					\
-	  trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0;			\
-	  $(gl_trap_);							\
-	  grep -f .re-defmac $$($(VC_LIST_EXCEPT))			\
+	  case $$(echo all: | grep -l -f - Makefile) in Makefile);; *)	\
+	    echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;;	\
+	  esac;								\
+	  $(def_sym_regex) | grep -f - $$($(VC_LIST_EXCEPT))		\
 	    && { echo '$(ME): define the above via some gnulib .h file'	\
 		  1>&2;  exit 1; } || :;				\
 	fi