From c8758b3f75a1492cf55f802d445526954cc7c1d3 Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.maroneze@cea.fr> Date: Tue, 1 Jun 2021 15:35:42 +0200 Subject: [PATCH] [analysis-scripts] avoid issues with 'sed --unbuffered' in Busybox's sed --- share/analysis-scripts/analysis.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/share/analysis-scripts/analysis.mk b/share/analysis-scripts/analysis.mk index 4984908d62f..3483b89d6d4 100644 --- a/share/analysis-scripts/analysis.mk +++ b/share/analysis-scripts/analysis.mk @@ -65,12 +65,15 @@ ifneq (4.0,$(firstword $(sort $(MAKE_VERSION) 4.0))) $(error This Makefile requires Make >= 4.0 - available at http://ftp.gnu.org/gnu/make/) endif -# Test if on a Mac (and therefore sed has fewer options) -# Also test if /usr/bin/time is available, otherwise use the shell builtin +# Test if sed has the '--unbuffered' option (GNU sed has, but neither macOS' +# nor Busybox' have it, in which case we ignore it) +SED_UNBUFFERED:=sed$(shell sed --unbuffered //p /dev/null 2>/dev/null && echo " --unbuffered" || true) + +# Test if on a Mac; +# test if /usr/bin/time is available, otherwise use the shell builtin # (which has less options) UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) - SED_UNBUFFERED:=sed ifneq (,$(wildcard /usr/bin/time)) define time_with_output /usr/bin/time -p @@ -81,7 +84,6 @@ define time_with_output endef endif else - SED_UNBUFFERED:=sed --unbuffered ifneq (,$(wildcard /usr/bin/time)) define time_with_output /usr/bin/time -f 'user_time=%U\nmemory=%M' -o "$(1)" -- GitLab