]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Makefiles/header.makefile
BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd
[mirror_edk2.git] / BaseTools / Source / C / Makefiles / header.makefile
CommitLineData
52302d4d
LG
1## @file\r
2#\r
6780eef1 3# The makefile can be invoked with\r
a9f6e0a4
LG
4# HOST_ARCH = x86_64 or x64 for EM64T build\r
5# HOST_ARCH = ia32 or IA32 for IA32 build\r
6# HOST_ARCH = ia64 or IA64 for IA64 build\r
7# HOST_ARCH = Arm or ARM for ARM build\r
6780eef1 8#\r
1eac82c8 9# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
40d841f6 10# This program and the accompanying materials\r
52302d4d
LG
11# are licensed and made available under the terms and conditions of the BSD License\r
12# which accompanies this distribution. The full text of the license may be found at\r
13# http://opensource.org/licenses/bsd-license.php\r
14#\r
15# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
6780eef1
LG
16# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
1eac82c8
LG
18ifndef HOST_ARCH\r
19 #\r
20 # If HOST_ARCH is not defined, then we use 'uname -m' to attempt\r
21 # try to figure out the appropriate HOST_ARCH.\r
22 #\r
23 uname_m = $(shell uname -m)\r
24 $(info Attempting to detect HOST_ARCH from 'uname -m': $(uname_m))\r
25 ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))\r
26 HOST_ARCH=X64\r
27 endif\r
28 ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)\r
29 HOST_ARCH=IA32\r
30 endif\r
31 ifneq (,$(findstring aarch64,$(uname_m)))\r
32 HOST_ARCH=AARCH64\r
33 endif\r
34 ifneq (,$(findstring arm,$(uname_m)))\r
35 HOST_ARCH=ARM\r
36 endif\r
37 ifndef HOST_ARCH\r
38 $(info Could not detected HOST_ARCH from uname results)\r
39 $(error HOST_ARCH is not defined!)\r
40 endif\r
41 $(info Detected HOST_ARCH of $(HOST_ARCH) using uname.)\r
42endif\r
6780eef1
LG
43\r
44CYGWIN:=$(findstring CYGWIN, $(shell uname -s))\r
45LINUX:=$(findstring Linux, $(shell uname -s))\r
46DARWIN:=$(findstring Darwin, $(shell uname -s))\r
47\r
a61331e8
LG
48BUILD_CC ?= gcc\r
49BUILD_CXX ?= g++\r
50BUILD_AS ?= gcc\r
51BUILD_AR ?= ar\r
52BUILD_LD ?= ld\r
53LINKER ?= $(BUILD_CC)\r
a9f6e0a4 54ifeq ($(HOST_ARCH), IA32)\r
6780eef1 55ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/\r
6780eef1 56\r
9d5aab05 57else ifeq ($(HOST_ARCH), X64)\r
6780eef1 58ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/\r
6780eef1 59\r
9d5aab05 60else ifeq ($(HOST_ARCH), ARM)\r
4afd3d04 61ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/\r
4afd3d04 62\r
9d5aab05 63else ifeq ($(HOST_ARCH), AARCH64)\r
e0ba625f 64ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/\r
9d5aab05
CG
65\r
66else\r
67$(error Bad HOST_ARCH)\r
e0ba625f
LL
68endif\r
69\r
6780eef1 70INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) \r
202726b3 71BUILD_CPPFLAGS = $(INCLUDE) -O2\r
438f3ad6
AF
72ifeq ($(DARWIN),Darwin)\r
73# assume clang or clang compatible flags on OS X\r
777f4aa0 74BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g\r
438f3ad6 75else\r
9222154a 76BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -c -g\r
438f3ad6 77endif\r
a61331e8 78BUILD_LFLAGS =\r
4fa9134e 79BUILD_CXXFLAGS = -Wno-unused-result\r
6780eef1 80\r
a9f6e0a4 81ifeq ($(HOST_ARCH), IA32)\r
6780eef1
LG
82#\r
83# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults \r
84# to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard\r
85# so only do this is uname -m returns i386.\r
86#\r
438f3ad6 87ifeq ($(DARWIN),Darwin)\r
a61331e8
LG
88 BUILD_CFLAGS += -arch i386\r
89 BUILD_CPPFLAGS += -arch i386\r
90 BUILD_LFLAGS += -arch i386\r
6780eef1
LG
91endif\r
92endif\r
93\r
94 \r
95.PHONY: all\r
96.PHONY: install\r
97.PHONY: clean\r
98\r
99all:\r
100\r
101$(MAKEROOT)/libs:\r
102 mkdir $(MAKEROOT)/libs \r
103\r
104$(MAKEROOT)/bin:\r
105 mkdir $(MAKEROOT)/bin\r