54d3c78f97a39467f5da3a1cf28a39a687e30da3
[mirror_edk2.git] / BaseTools / Source / C / Makefiles / header.makefile
1 ## @file
2 #
3 # The makefile can be invoked with
4 # ARCH = x86_64 or x64 for EM64T build
5 # ARCH = ia32 or IA32 for IA32 build
6 # ARCH = ia64 or IA64 for IA64 build
7 # ARCH = Arm or ARM for ARM build
8 #
9 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
10 # This program and the accompanying materials
11 # are licensed and made available under the terms and conditions of the BSD License
12 # which accompanies this distribution. The full text of the license may be found at
13 # http://opensource.org/licenses/bsd-license.php
14 #
15 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 ARCH ?= IA32
19
20 CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
21 LINUX:=$(findstring Linux, $(shell uname -s))
22 DARWIN:=$(findstring Darwin, $(shell uname -s))
23
24 CC = gcc
25 CXX = g++
26 AS = gcc
27 AR = ar
28 LD = ld
29 LINKER ?= $(CC)
30 ifeq ($(ARCH), IA32)
31 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
32 endif
33
34 ifeq ($(ARCH), X64)
35 ARCH_INCLUDE = -I $(MAKEROOT)/Include/X64/
36 endif
37
38 ifeq ($(ARCH), ARM)
39 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Arm/
40 endif
41
42 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
43 CPPFLAGS = $(INCLUDE)
44 ifeq ($(DARWIN),Darwin)
45 # assume clang or clang compatible flags on OS X
46 CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g
47 else
48 CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -nostdlib -c -g
49 endif
50 LFLAGS =
51
52 ifeq ($(ARCH), IA32)
53 #
54 # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
55 # to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard
56 # so only do this is uname -m returns i386.
57 #
58 ifeq ($(DARWIN),Darwin)
59 CFLAGS += -arch i386
60 CPPFLAGS += -arch i386
61 LFLAGS += -arch i386
62 endif
63 endif
64
65
66 .PHONY: all
67 .PHONY: install
68 .PHONY: clean
69
70 all:
71
72 $(MAKEROOT)/libs:
73 mkdir $(MAKEROOT)/libs
74
75 $(MAKEROOT)/bin:
76 mkdir $(MAKEROOT)/bin