aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2024-11-27 17:16:45 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-11-28 14:03:16 +0100
commitd9c0f8eefb0015a5a06c7259666c877fff6fbe92 (patch)
tree21d101b35b7200fc1a8f65f5bbbccb555998c52f
parentb6e79efa0b0c8ab6327f5184f81c5b3ab8af4ff8 (diff)
downloadpasst-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar.gz
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar.bz2
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar.lz
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar.xz
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.tar.zst
passt-d9c0f8eefb0015a5a06c7259666c877fff6fbe92.zip
Makefile: Use make internal string functions
TARGET_ARCH is computed from '$(CC) -dumpmachine' using external bash commands like echo, cut, tr and sed. This can be done using make internal string functions. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index cb74480..1fce737 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,9 @@ DUAL_STACK_SOCKETS := 1
TARGET ?= $(shell $(CC) -dumpmachine)
# Get 'uname -m'-like architecture description for target
-TARGET_ARCH := $(shell echo $(TARGET) | cut -f1 -d- | tr [A-Z] [a-z])
-TARGET_ARCH := $(shell echo $(TARGET_ARCH) | sed 's/powerpc/ppc/')
+TARGET_ARCH := $(firstword $(subst -, ,$(TARGET)))
+TARGET_ARCH := $(patsubst [:upper:],[:lower:],$(TARGET_ARCH))
+TARGET_ARCH := $(subst powerpc,ppc,$(TARGET_ARCH))
# On some systems enabling optimization also enables source fortification,
# automagically. Do not override it.