Home | History | Annotate | Download | only in Makefiles
      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 - 2016, 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 BUILD_CC ?= gcc
     25 BUILD_CXX ?= g++
     26 BUILD_AS ?= gcc
     27 BUILD_AR ?= ar
     28 BUILD_LD ?= ld
     29 LINKER ?= $(BUILD_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 ifeq ($(ARCH), AARCH64)
     43 ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
     44 endif
     45 
     46 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
     47 BUILD_CPPFLAGS = $(INCLUDE) -O2
     48 ifeq ($(DARWIN),Darwin)
     49 # assume clang or clang compatible flags on OS X

     50 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
     51 else
     52 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
     53 endif
     54 BUILD_LFLAGS =
     55 BUILD_CXXFLAGS = -Wno-unused-result
     56 
     57 ifeq ($(ARCH), IA32)
     58 #

     59 # Snow Leopard  is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults 

     60 #  to x86_64. So make sure tools match uname -m. You can manual have a 64-bit kernal on Snow Leopard

     61 #  so only do this is uname -m returns i386.

     62 #

     63 ifeq ($(DARWIN),Darwin)
     64   BUILD_CFLAGS   += -arch i386
     65   BUILD_CPPFLAGS += -arch i386
     66   BUILD_LFLAGS   += -arch i386
     67 endif
     68 endif
     69 
     70   
     71 .PHONY: all
     72 .PHONY: install
     73 .PHONY: clean
     74 
     75 all:
     76 
     77 $(MAKEROOT)/libs:
     78 	mkdir $(MAKEROOT)/libs 
     79 
     80 $(MAKEROOT)/bin:
     81 	mkdir $(MAKEROOT)/bin
     82