Home | History | Annotate | Download | only in Scripts
      1 #/* @file

      2 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.

      3 #  

      4 #  This program and the accompanying materials                          

      5 #  are licensed and made available under the terms and conditions of the BSD License         

      6 #  which accompanies this distribution.  The full text of the license may be found at        

      7 #  http://opensource.org/licenses/bsd-license.php                                            

      8 #

      9 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

     10 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

     11 #

     12 #*/

     13 
     14 # Define the following variable to specify an alternative toolchain to the one located in your PATH:

     15 # - RVCT_TOOLS_PATH: for RVCT and RVCTLINUX toolchains

     16 
     17 EDK2_TOOLCHAIN ?= RVCTLINUX
     18 EDK2_ARCH ?= ARM
     19 EDK2_BUILD ?= DEBUG
     20 
     21 ifeq ($(EDK2_DSC),"")
     22   $(error The Makfile macro 'EDK2_DSC' must be defined with an EDK2 DSC file.)
     23 endif
     24 ifeq ("$(EDK2_DSC)","ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc")
     25   BUILD_FIP=1
     26   BUILD_PATH=$(WORKSPACE)/Build/ArmVExpress-FVP-AArch64
     27   UEFI_BIN=FVP_AARCH64_EFI.fd
     28 endif
     29 
     30 ifeq ("$(OS)","Windows_NT")
     31 export WORKSPACE?=$(PWD)
     32 export EDK_TOOLS_PATH ?= $(WORKSPACE)\BaseTools
     33 endif
     34 
     35 SHELL := /bin/bash
     36 SILENT ?= @
     37 ECHO ?= echo
     38 MAKE ?= make -i -k
     39 RM ?= rm -f
     40 
     41 .PHONY: all clean
     42 
     43 EDK2_CONF = Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt
     44 
     45 #

     46 # FIP Support

     47 #

     48 ifeq ($(BUILD_FIP),"1")
     49   ifeq ($(FIP_BIN),"")
     50     $(info Define location of the FIP to automatically update the package after building UEFI.)
     51   endif
     52 endif
     53 
     54 all: $(EDK2_CONF)
     55 ifeq ("$(OS)","Windows_NT")
     56 	build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
     57 else
     58 	. ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
     59 endif
     60 ifeq ("$(BUILD_FIP)","1")
     61 ifneq ($(FIP_BIN),"")
     62 	$(SILENT)which fip_create ; \
     63 	if [ $$? -ne 0 ]; then \
     64 	  $(ECHO) "Warning: 'fip_create' tool is not in the PATH. The UEFI binary will not be added in the Firmware Image Package (FIP)."; \
     65 	else \
     66 	  fip_create --bl33 $(BUILD_PATH)/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/$(UEFI_BIN) --dump $(FIP_BIN); \
     67 	fi
     68 endif
     69 endif
     70 
     71 $(EDK2_CONF):
     72 ifeq ("$(OS)","Windows_NT")
     73 	copy $(EDK_TOOLS_PATH)\Conf\build_rule.template Conf\build_rule.txt
     74 	copy $(EDK_TOOLS_PATH)\Conf\FrameworkDatabase.template Conf\FrameworkDatabase.txt
     75 	copy $(EDK_TOOLS_PATH)\Conf\target.template Conf\target.txt
     76 	copy $(EDK_TOOLS_PATH)\Conf\tools_def.template Conf\tools_def.txt
     77 else
     78 	. ./edksetup.sh; $(MAKE) -C BaseTools
     79 endif
     80 
     81 clean:
     82 ifeq ("$(OS)","Windows_NT")
     83 	build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall
     84 else
     85 	. ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall; \
     86 	rm -Rf $(EDK2_CONF) Conf/.cache
     87 endif
     88