From d719799731294f672aa6baa9c1b1387642159c6c Mon Sep 17 00:00:00 2001
From: Patrick Baudin <patrick.baudin@cea.fr>
Date: Wed, 22 Jun 2022 11:09:34 +0200
Subject: [PATCH] [Makefile] conditional definition for MacOS

---
 share/Makefile.common  | 8 +++++---
 share/Makefile.linting | 6 ++++++
 share/Makefile.testing | 8 +++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/share/Makefile.common b/share/Makefile.common
index 083461f2595..c3f8cd6de2d 100644
--- a/share/Makefile.common
+++ b/share/Makefile.common
@@ -147,13 +147,15 @@ eval last=\$${$$\#}; \
 mv $$new_temp $$last' sed_inplace
 SED	= LC_ALL=C sed
 RM	= rm -f
-ifeq ($(shell uname -s 2> /dev/null),Darwin)
+TOUCH   = touch
+GIT	= git
+
+ifeq ($(PLATFORM),MacOS)
 TAR     = gtar
 else
+# Unix, Cygwin
 TAR     = tar
 endif
-TOUCH   = touch
-GIT	= git
 
 ##################
 # Make commands #
diff --git a/share/Makefile.linting b/share/Makefile.linting
index 5d2d83119ac..36ff2f7384e 100644
--- a/share/Makefile.linting
+++ b/share/Makefile.linting
@@ -66,7 +66,13 @@ MV      ?= mv
 RM      ?= rm -f
 RMDIR   ?= rm -rf
 TOUCH   ?= touch
+
+ifeq ($(PLATFORM),MacOS)
+XARGS   ?= xargs
+else
+# Unix, Cygwin
 XARGS   ?= xargs --no-run-if-empty
+endif
 
 ############
 
diff --git a/share/Makefile.testing b/share/Makefile.testing
index 7b9b0bca93f..df0f78075be 100644
--- a/share/Makefile.testing
+++ b/share/Makefile.testing
@@ -35,11 +35,17 @@ PTEST_DIRS?=$(PURGED_PTEST_DIRS)
 ############
 # Default values necessary for make -f <this-makefile>
 
-XARGS   ?= xargs --no-run-if-empty
 GREP    ?= grep
 RM      ?= rm -f
 RMDIR   ?= rm -rf
 
+ifeq ($(PLATFORM),MacOS)
+XARGS   ?= xargs
+else
+# Unix, Cygwin
+XARGS   ?= xargs --no-run-if-empty
+endif
+
 ##########################################################################
 
 # Defines the related dune targets
-- 
GitLab