blob: f933755b5193a071251280f9828a98ef1e3ff0fe [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301#/* @file
2# Copyright (c) 2011-2014, 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 variables to specify an alternative toolchain to the one located in your PATH:
15# - RVCT_TOOLS_PATH: for RVCT and RVCTLINUX toolchains
16# - ARMGCC_TOOLS_PATH: for ARMGCC toolchain
17# - ARMLINUXGCC_TOOLS_PATH: for ARMLINUXGCC
18
19EDK2_TOOLCHAIN ?= RVCTLINUX
20EDK2_ARCH ?= ARM
21EDK2_BUILD ?= DEBUG
22
23ifeq ($(EDK2_DSC),"")
24 $(error The Makfile macro 'EDK2_DSC' must be defined with an EDK2 DSC file.)
25endif
26
27ifeq ("$(OS)","Windows_NT")
28export WORKSPACE?=$(PWD)
29export EDK_TOOLS_PATH ?= $(WORKSPACE)\BaseTools
30endif
31
32SHELL := /bin/bash
33SILENT ?= @
34ECHO ?= echo
35MAKE ?= make -i -k
36RM ?= rm -f
37
38.PHONY: all clean
39
40EDK2_CONF = Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt
41
42all: $(EDK2_CONF)
43ifeq ("$(OS)","Windows_NT")
44 build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
45else
46 . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS)
47endif
48
49$(EDK2_CONF):
50ifeq ("$(OS)","Windows_NT")
51 copy $(EDK_TOOLS_PATH)\Conf\build_rule.template Conf\build_rule.txt
52 copy $(EDK_TOOLS_PATH)\Conf\FrameworkDatabase.template Conf\FrameworkDatabase.txt
53 copy $(EDK_TOOLS_PATH)\Conf\target.template Conf\target.txt
54 copy $(EDK_TOOLS_PATH)\Conf\tools_def.template Conf\tools_def.txt
55else
56 . ./edksetup.sh; $(MAKE) -C BaseTools
57endif
58
59clean:
60ifeq ("$(OS)","Windows_NT")
61 build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall
62else
63 . ./edksetup.sh; build -a $(EDK2_ARCH) -p $(EDK2_DSC) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) $(EDK2_MACROS) cleanall; \
64 rm -Rf $(EDK2_CONF) Conf/.cache
65endif