]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Makefiles/header.makefile
BaseTools: Fix build on FreeBSD and allow use of non-gcc system compiler
[mirror_edk2.git] / BaseTools / Source / C / Makefiles / header.makefile
CommitLineData
52302d4d
LG
1## @file\r
2#\r
6780eef1
LG
3# The makefile can be invoked with\r
4# ARCH = x86_64 or x64 for EM64T build\r
5# ARCH = ia32 or IA32 for IA32 build\r
6# ARCH = ia64 or IA64 for IA64 build\r
4afd3d04 7# ARCH = Arm or ARM for ARM build\r
6780eef1 8#\r
40d841f6
LG
9# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
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
18ARCH ?= IA32\r
19\r
20CYGWIN:=$(findstring CYGWIN, $(shell uname -s))\r
21LINUX:=$(findstring Linux, $(shell uname -s))\r
22DARWIN:=$(findstring Darwin, $(shell uname -s))\r
23\r
5ddccf34
BC
24CC ?= gcc\r
25CXX ?= g++\r
26AS ?= gcc\r
27AR ?= ar\r
28LD ?= ld\r
6780eef1
LG
29LINKER ?= $(CC)\r
30ifeq ($(ARCH), IA32)\r
31ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/\r
32endif\r
33\r
34ifeq ($(ARCH), X64)\r
35ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/\r
36endif\r
37\r
4afd3d04
LG
38ifeq ($(ARCH), ARM)\r
39ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/\r
40endif\r
41\r
e0ba625f
LL
42ifeq ($(ARCH), AARCH64)\r
43ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/\r
44endif\r
45\r
6780eef1
LG
46INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) \r
47CPPFLAGS = $(INCLUDE)\r
438f3ad6
AF
48ifeq ($(DARWIN),Darwin)\r
49# assume clang or clang compatible flags on OS X\r
f7523dee 50CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g\r
438f3ad6
AF
51else\r
52CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -nostdlib -c -g\r
53endif\r
6780eef1
LG
54LFLAGS =\r
55\r
56ifeq ($(ARCH), IA32)\r
57#\r
58# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults \r
59# to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard\r
60# so only do this is uname -m returns i386.\r
61#\r
438f3ad6 62ifeq ($(DARWIN),Darwin)\r
6780eef1
LG
63 CFLAGS += -arch i386\r
64 CPPFLAGS += -arch i386\r
65 LFLAGS += -arch i386\r
66endif\r
67endif\r
68\r
69 \r
70.PHONY: all\r
71.PHONY: install\r
72.PHONY: clean\r
73\r
74all:\r
75\r
76$(MAKEROOT)/libs:\r
77 mkdir $(MAKEROOT)/libs \r
78\r
79$(MAKEROOT)/bin:\r
80 mkdir $(MAKEROOT)/bin\r