3 # The makefile can be invoked with
4 # HOST_ARCH = x86_64 or x64 for EM64T build
5 # HOST_ARCH = ia32 or IA32 for IA32 build
6 # HOST_ARCH = Arm or ARM for ARM build
8 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
9 # This program and the accompanying materials
10 # are licensed and made available under the terms and conditions of the BSD License
11 # which accompanies this distribution. The full text of the license may be found at
12 # http://opensource.org/licenses/bsd-license.php
14 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 # If HOST_ARCH is not defined, then we use 'uname -m' to attempt
20 # try to figure out the appropriate HOST_ARCH.
22 uname_m = $(shell uname -m)
23 $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))
24 ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
27 ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
30 ifneq (,$(findstring aarch64,$(uname_m)))
33 ifneq (,$(findstring arm,$(uname_m)))
37 $(info Could not detected HOST_ARCH from uname results)
38 $(error HOST_ARCH is not defined!)
40 $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)
43 CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
44 LINUX:=$(findstring Linux, $(shell uname -s))
45 DARWIN:=$(findstring Darwin, $(shell uname -s))
53 ifeq ($(HOST_ARCH), IA32)
54 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
56 else ifeq ($(HOST_ARCH), X64)
57 ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
59 else ifeq ($(HOST_ARCH), ARM)
60 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
62 else ifeq ($(HOST_ARCH), AARCH64)
63 ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
66 $(error Bad HOST_ARCH)
69 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
70 BUILD_CPPFLAGS = $(INCLUDE)
72 # keep EXTRA_OPTFLAGS last
73 BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS)
75 ifeq ($(DARWIN),Darwin)
76 # assume clang or clang compatible flags on OS X
77 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
79 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -g
82 BUILD_CXXFLAGS = -Wno-unused-result
84 ifeq ($(HOST_ARCH), IA32)
86 # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
87 # to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard
88 # so only do this is uname -m returns i386.
90 ifeq ($(DARWIN),Darwin)
91 BUILD_CFLAGS += -arch i386
92 BUILD_CPPFLAGS += -arch i386
93 BUILD_LFLAGS += -arch i386
97 # keep BUILD_OPTFLAGS last
98 BUILD_CFLAGS += $(BUILD_OPTFLAGS)
99 BUILD_CXXFLAGS += $(BUILD_OPTFLAGS)
101 # keep EXTRA_LDFLAGS last
102 BUILD_LFLAGS += $(EXTRA_LDFLAGS)
111 mkdir $(MAKEROOT)/libs
114 mkdir $(MAKEROOT)/bin