From 7f7d18ebc66d7894d86cb26bae855895a2f359e0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 22 Jun 2019 17:52:16 +0200 Subject: maintainer-makefile: restore portability to non-GNU awks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Tim Rühsen. * top/maint.mk (AWK): New variable. Use it. (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk. --- top/maint.mk | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'top') 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 -- cgit v1.2.1