]>
Commit | Line | Data |
---|---|---|
b76848cb | 1 | #!/bin/bash |
2 | # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> | |
3 | # This program and the accompanying materials | |
4 | # are licensed and made available under the terms and conditions of the BSD License | |
5 | # which accompanies this distribution. The full text of the license may be found at | |
6 | # http://opensource.org/licenses/bsd-license.php | |
7 | # | |
8 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
9 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
10 | # | |
11 | ||
12 | set -e | |
13 | shopt -s nocasematch | |
14 | ||
15 | function process_debug_scripts { | |
16 | if [[ -d $1 ]]; then | |
17 | for filename in `ls $1` | |
18 | do | |
19 | sed -e "s@ZZZZZZ@$BUILD_ROOT@g" -e "s@WWWWWW@$WORKSPACE@g" \ | |
20 | "$1/$filename" \ | |
21 | > "$BUILD_ROOT/$filename" | |
22 | ||
23 | #For ARMCYGWIN, we have to change /cygdrive/c to c: | |
24 | if [[ $TARGET_TOOLS == RVCT31CYGWIN ]] | |
25 | then | |
26 | mv "$BUILD_ROOT/$filename" "$BUILD_ROOT/$filename"_temp | |
27 | sed -e "s@/cygdrive/\(.\)@\1:@g" \ | |
28 | "$BUILD_ROOT/$filename"_temp \ | |
29 | > "$BUILD_ROOT/$filename" | |
30 | rm -f "$BUILD_ROOT/$filename"_temp | |
31 | fi | |
32 | done | |
33 | fi | |
34 | } | |
35 | ||
36 | ||
37 | # | |
38 | # Setup workspace if it is not set | |
39 | # | |
40 | if [ -z "$WORKSPACE" ] | |
41 | then | |
42 | echo Initializing workspace | |
43 | cd .. | |
44 | export EDK_TOOLS_PATH=`pwd`/BaseTools | |
45 | source edksetup.sh BaseTools | |
46 | else | |
47 | echo Building from: $WORKSPACE | |
48 | fi | |
49 | ||
50 | # | |
51 | # Pick a default tool type for a given OS | |
52 | # | |
53 | case `uname` in | |
54 | CYGWIN*) | |
55 | TARGET_TOOLS=RVCT31CYGWIN | |
56 | ;; | |
57 | Linux*) | |
58 | # Not tested | |
59 | TARGET_TOOLS=ARMGCC | |
60 | ;; | |
61 | Darwin*) | |
62 | Major=$(uname -r | cut -f 1 -d '.') | |
63 | if [[ $Major == 9 ]] | |
64 | then | |
65 | # Not supported by this open source project | |
66 | TARGET_TOOLS=XCODE31 | |
67 | else | |
68 | TARGET_TOOLS=XCODE32 | |
69 | fi | |
70 | ;; | |
71 | esac | |
72 | ||
73 | TARGET=DEBUG | |
74 | for arg in "$@" | |
75 | do | |
76 | if [[ $arg == RELEASE ]]; | |
77 | then | |
78 | TARGET=RELEASE | |
79 | fi | |
80 | done | |
81 | ||
afdfe8f0 | 82 | BUILD_ROOT=$WORKSPACE/Build/ArmRealViewEb/"$TARGET"_"$TARGET_TOOLS" |
b76848cb | 83 | |
84 | if [[ ! -e $EDK_TOOLS_PATH/Source/C/bin ]]; | |
85 | then | |
86 | # build the tools if they don't yet exist | |
87 | echo Building tools: $EDK_TOOLS_PATH | |
88 | make -C $EDK_TOOLS_PATH | |
89 | else | |
90 | echo using prebuilt tools | |
91 | fi | |
92 | ||
93 | # | |
94 | # Build the edk2 ArmEb code | |
95 | # | |
96 | if [[ $TARGET == RELEASE ]]; then | |
afdfe8f0 | 97 | build -p $WORKSPACE/ArmRealViewEbPkg/ArmRealViewEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET -D DEBUG_TARGET=RELEASE $2 $3 $4 $5 $6 $7 $8 |
b76848cb | 98 | else |
afdfe8f0 | 99 | build -p $WORKSPACE/ArmRealViewEbPkg/ArmRealViewEbPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET $1 $2 $3 $4 $5 $6 $7 $8 |
b76848cb | 100 | fi |
101 | ||
102 | ||
103 | for arg in "$@" | |
104 | do | |
105 | if [[ $arg == clean ]]; then | |
106 | # no need to post process if we are doing a clean | |
107 | exit | |
108 | elif [[ $arg == cleanall ]]; then | |
109 | make -C $EDK_TOOLS_PATH clean | |
110 | exit | |
111 | ||
112 | fi | |
113 | done | |
114 | ||
115 | ||
116 | echo Creating debugger scripts | |
afdfe8f0 | 117 | process_debug_scripts $WORKSPACE/ArmRealViewEbPkg/Debugger_scripts |
b76848cb | 118 |