public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] Makefile: Enable external override for TARGET
@ 2023-03-15  9:14 Stefano Brivio
  2023-03-18  2:01 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2023-03-15  9:14 UTC (permalink / raw)
  To: passt-dev

A cross-architecture build might pass a target-specific CC on 'make',
and not on 'make install', and this is what happens in Debian
cross-qa tests.

Given that we select binaries to be installed depending on the target
architecture, this means we would build AVX2 binaries in any case on
a x86_64 build machine.

By overriding TARGET in package build rules, we can tell the Makefile
about the target architecture, also for the 'install' (Makefile)
target.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6f8bd81..0dd1057 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ ifeq ($(RLIMIT_STACK_VAL),unlimited)
 RLIMIT_STACK_VAL := 1024
 endif
 
-TARGET := $(shell $(CC) -dumpmachine)
+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/')
-- 
@@ -20,7 +20,7 @@ ifeq ($(RLIMIT_STACK_VAL),unlimited)
 RLIMIT_STACK_VAL := 1024
 endif
 
-TARGET := $(shell $(CC) -dumpmachine)
+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/')
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile: Enable external override for TARGET
  2023-03-15  9:14 [PATCH] Makefile: Enable external override for TARGET Stefano Brivio
@ 2023-03-18  2:01 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2023-03-18  2:01 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev

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

On Wed, Mar 15, 2023 at 10:14:00AM +0100, Stefano Brivio wrote:
> A cross-architecture build might pass a target-specific CC on 'make',
> and not on 'make install', and this is what happens in Debian
> cross-qa tests.
> 
> Given that we select binaries to be installed depending on the target
> architecture, this means we would build AVX2 binaries in any case on
> a x86_64 build machine.
> 
> By overriding TARGET in package build rules, we can tell the Makefile
> about the target architecture, also for the 'install' (Makefile)
> target.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 6f8bd81..0dd1057 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -20,7 +20,7 @@ ifeq ($(RLIMIT_STACK_VAL),unlimited)
>  RLIMIT_STACK_VAL := 1024
>  endif
>  
> -TARGET := $(shell $(CC) -dumpmachine)
> +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/')

-- 
David Gibson			| 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-18  5:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15  9:14 [PATCH] Makefile: Enable external override for TARGET Stefano Brivio
2023-03-18  2:01 ` David Gibson

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