summaryrefslogtreecommitdiff
path: root/top
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-06-22 17:52:16 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-06-24 17:55:48 +0200
commit7f7d18ebc66d7894d86cb26bae855895a2f359e0 (patch)
treef88918d48fae4082d99bd00306cc6412fec7daf2 /top
parent232ba923073d6f1bebb6ae1baaa7feb68b90619a (diff)
downloadgnulib-7f7d18ebc66d7894d86cb26bae855895a2f359e0.tar.gz
maintainer-makefile: restore portability to non-GNU awks
Reported by Tim Rühsen. * top/maint.mk (AWK): New variable. Use it. (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
Diffstat (limited to 'top')
-rw-r--r--top/maint.mk21
1 files changed, 12 insertions, 9 deletions
diff --git a/top/maint.mk b/top/maint.mk
index 3dbe9c3788..16e936022c 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -24,6 +24,7 @@ ME := maint.mk
# These variables ought to be defined through the configure.ac section
# of the module description. But some packages import this file directly,
# ignoring the module description.
+AWK ?= awk
GREP ?= grep
SED ?= sed
@@ -190,7 +191,7 @@ $(sc_z_rules_): %.z: %
@end=$$(date +%s.%N); \
start=$$(cat .sc-start-$*); \
rm -f .sc-start-$*; \
- awk -v s=$$start -v e=$$end \
+ $(AWK) -v s=$$start -v e=$$end \
'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
# The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
@@ -435,13 +436,15 @@ sc_prohibit_gnu_make_extensions_awk_ = \
exit status; \
}
sc_prohibit_gnu_make_extensions:
- (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') | \
- tr ' ' '\n' | \
- $(SED) -ne '/Makefile/{s/\.in$$//;p;}' | \
- while read m; do \
- $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null | \
- awk -v file=$$m -e '$($@_awk_)' || exit 1; \
- done
+ @if $(AWK) --version | grep GNU >/dev/null 2>&1; then \
+ (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') | \
+ tr ' ' '\n' | \
+ $(SED) -ne '/Makefile/{s/\.in$$//;p;}' | \
+ while read m; do \
+ $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null | \
+ $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1; \
+ done; \
+ fi
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use '0' instead.
@@ -1383,7 +1386,7 @@ gpg_key_ID ?= \
$$(cd $(srcdir) \
&& git cat-file tag v$(VERSION) \
| $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null \
- | awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
+ | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
translation_project_ ?= coordinator@translationproject.org