From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H7XpF27y; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id A54C05A004E for ; Wed, 27 Nov 2024 17:16:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732724210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/h1i6zw2YFN6Exe1tC1SGe9XLEORNwr5xiM0vC8F8Yo=; b=H7XpF27yGWFB00vbklB9hF2gmFZfxqnSnGnI/18qNq3r0sJoOR4/Wgxf29FKFWbtjw05Hz X5JYE0CcsVoZoYVLekl1SKCgfvJOkyx4W3tEorzWmStVyYyF6KxZXYfZuh52WSUKXKkDAp pL9SSWaUxBd4eDn9fyYdj3cTKd5wI6A= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-624-bydCk_qUOWuIJ_Pq4gQy6w-1; Wed, 27 Nov 2024 11:16:48 -0500 X-MC-Unique: bydCk_qUOWuIJ_Pq4gQy6w-1 X-Mimecast-MFC-AGG-ID: bydCk_qUOWuIJ_Pq4gQy6w Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0EEB31955F42 for ; Wed, 27 Nov 2024 16:16:48 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.193.108]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 18CDF3003B76; Wed, 27 Nov 2024 16:16:46 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] Makefile: Use make internal string functions Date: Wed, 27 Nov 2024 17:16:45 +0100 Message-ID: <20241127161645.3649591-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ybRv_bTLZ05ul8f0nH5UzR_3KYHAJMgUo-YAhll5gK4_1732724208 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: NEOFNOGXFCNFWH4NPEXLC7SPZPC2DFIW X-Message-ID-Hash: NEOFNOGXFCNFWH4NPEXLC7SPZPC2DFIW X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cb7448079de5..1fce73707805 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. -- 2.47.0