public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] Makefile: Use make internal string functions
Date: Thu, 28 Nov 2024 09:33:47 +1100	[thread overview]
Message-ID: <Z0eeS0oL5Sfuk6hD@zatzit> (raw)
In-Reply-To: <20241127161645.3649591-1-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

On Wed, Nov 27, 2024 at 05:16:45PM +0100, Laurent Vivier wrote:
> 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>

> ---
>  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.

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-11-27 23:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 16:16 [PATCH] Makefile: Use make internal string functions Laurent Vivier
2024-11-27 22:33 ` David Gibson [this message]
2024-11-28 13:03 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0eeS0oL5Sfuk6hD@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).