]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/build64.sh
Clean up DEC files:
[mirror_edk2.git] / UnixPkg / build64.sh
CommitLineData
67f86803 1#!/bin/bash
2#
3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
75f18f34 4# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5#
67f86803 6# This program and the accompanying materials
7# are licensed and made available under the terms and conditions of the BSD License
8# which accompanies this distribution. The full text of the license may be found at
9# http://opensource.org/licenses/bsd-license.php
10#
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14
15set -e
16shopt -s nocasematch
17
18
67f86803 19#
20# Setup workspace if it is not set
21#
22if [ -z "$WORKSPACE" ]
23then
24 echo Initializing workspace
75f18f34 25 if [ ! -e `pwd`/edksetup.sh ]
26 then
27 cd ..
28 fi
67f86803 29# This version is for the tools in the BaseTools project.
30# this assumes svn pulls have the same root dir
31# export EDK_TOOLS_PATH=`pwd`/../BaseTools
32# This version is for the tools source in edk2
33 export EDK_TOOLS_PATH=`pwd`/BaseTools
34 echo $EDK_TOOLS_PATH
35 source edksetup.sh BaseTools
36else
37 echo Building from: $WORKSPACE
38fi
39
40#
41# Pick a default tool type for a given OS
42#
43TARGET_TOOLS=MYTOOLS
a761d497 44UNIXPKG_TOOLS=GCC44
692477d4 45NETWORK_SUPPORT=
67f86803 46case `uname` in
47 CYGWIN*) echo Cygwin not fully supported yet. ;;
a761d497 48 Darwin*)
67f86803 49 Major=$(uname -r | cut -f 1 -d '.')
50 if [[ $Major == 9 ]]
51 then
52 echo UnixPkg requires Snow Leopard or later OS
53 exit 1
a761d497 54 else
67f86803 55 TARGET_TOOLS=XCODE32
2d7df642 56 UNIXPKG_TOOLS=XCLANG
a761d497 57 fi
692477d4 58 NETWORK_SUPPORT="-D NETWORK_SUPPORT"
67f86803 59 ;;
60 Linux*) TARGET_TOOLS=ELFGCC ;;
a761d497 61
67f86803 62esac
63
bb111c23 64BUILD_ROOT_ARCH=$WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
67f86803 65
66if [[ ! -f `which build` || ! -f `which GenFv` ]];
67then
68 # build the tools if they don't yet exist. Bin scheme
69 echo Building tools as they are not in the path
70 make -C $WORKSPACE/BaseTools
71elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
72then
73 # build the tools if they don't yet exist. BinWrapper scheme
74 echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
75 make -C $WORKSPACE/BaseTools
76else
77 echo using prebuilt tools
78fi
79
80
81for arg in "$@"
82do
83 if [[ $arg == run ]]; then
84 case `uname` in
a761d497 85 Darwin*)
67f86803 86 #
87 # On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
88 # This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
89 # images that get loaded in SecMain
90 #
bb111c23 91 cp $WORKSPACE/UnixPkg/.gdbinit $WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
67f86803 92 ;;
a761d497 93 esac
67f86803 94
95 /usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH
96 exit
97 fi
98
99 if [[ $arg == cleanall ]]; then
a761d497 100 make -C $WORKSPACE/BaseTools clean
45059fab 101 build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
102 build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
103 exit $?
104 fi
105
106 if [[ $arg == clean ]]; then
107 build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
108 build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
109 exit $?
67f86803 110 fi
a761d497 111
185969ed 112 if [[ $arg == shell ]]; then
75f18f34 113 build -p $WORKSPACE/GccShellPkg/GccShellPkg.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 $2 $3 $4 $5 $6 $7 $8
185969ed 114 exit $?
115 fi
67f86803 116done
117
118
119#
120# Build the edk2 UnixPkg
121#
122echo $PATH
123echo `which build`
bb111c23 124build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules
692477d4 125build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
bb111c23 126cp $WORKSPACE/Build/UnixX64/DEBUG_"$TARGET_TOOLS"/X64/SecMain $WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
67f86803 127exit $?
128