public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Liming Gao <liming.gao@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch 1/2] BaseTools GNUmakefile: Move HOST_ARCH detection into common makefile
Date: Wed, 31 Jan 2018 19:59:56 +0800	[thread overview]
Message-ID: <1517399997-1784-2-git-send-email-liming.gao@intel.com> (raw)
In-Reply-To: <1517399997-1784-1-git-send-email-liming.gao@intel.com>

With this change, enter single tool directory, make can pass.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/Makefiles/header.makefile | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
index e034da2..0976973 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -6,7 +6,7 @@
 # HOST_ARCH = ia64 or IA64 for IA64 build
 # HOST_ARCH = Arm or ARM for ARM build
 #
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.    The full text of the license may be found at
@@ -15,7 +15,31 @@
 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-HOST_ARCH ?= IA32
+ifndef HOST_ARCH
+  #
+  # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
+  # try to figure out the appropriate HOST_ARCH.
+  #
+  uname_m = $(shell uname -m)
+  $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
+  ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
+    HOST_ARCH=X64
+  endif
+  ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
+    HOST_ARCH=IA32
+  endif
+  ifneq (,$(findstring aarch64,$(uname_m)))
+    HOST_ARCH=AARCH64
+  endif
+  ifneq (,$(findstring arm,$(uname_m)))
+    HOST_ARCH=ARM
+  endif
+  ifndef HOST_ARCH
+    $(info Could not detected HOST_ARCH from uname results)
+    $(error HOST_ARCH is not defined!)
+  endif
+  $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
+endif
 
 CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
 LINUX:=$(findstring Linux, $(shell uname -s))
-- 
2.8.0.windows.1



  reply	other threads:[~2018-01-31 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 11:59 [Patch 0/2] BaseTools GNUmakefile: Move HOST_ARCH detection into common makefile Liming Gao
2018-01-31 11:59 ` Liming Gao [this message]
2018-01-31 11:59 ` [Patch 2/2] BaseTools GNUmakefile: Remove HOST_ARCH in every tool Makefile Liming Gao
2018-02-05  3:23 ` [Patch 0/2] BaseTools GNUmakefile: Move HOST_ARCH detection into common makefile Zhu, Yonghong

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-list 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=1517399997-1784-2-git-send-email-liming.gao@intel.com \
    --to=devel@edk2.groups.io \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox