-if [ \
- "$1" = Rebuild -o \
- "$1" = ForceRebuild -o \
- ! -e "$WORKSPACE/Tools/Jars/Common.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/PcdTools.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/GenBuild.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/SurfaceArea.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/cpptasks.jar" -o \
- ! -e "$WORKSPACE/Tools/Jars/frameworktasks.jar" -o \
- ! -e "$WORKSPACE/Tools/bin/FrameworkWizard.jar" -o \
- ! -e "$WORKSPACE/Tools/bin/CompressDll.dll" -o \
- ! -e "$WORKSPACE/Tools/bin/CreateMtFile" -o \
- ! -e "$WORKSPACE/Tools/bin/EfiCompress" -o \
- ! -e "$WORKSPACE/Tools/bin/EfiRom" -o \
- ! -e "$WORKSPACE/Tools/bin/FlashMap" -o \
- ! -e "$WORKSPACE/Tools/bin/FwImage" -o \
- ! -e "$WORKSPACE/Tools/bin/GenAcpiTable" -o \
- ! -e "$WORKSPACE/Tools/bin/GenCRC32Section" -o \
- ! -e "$WORKSPACE/Tools/bin/GenCapsuleHdr" -o \
- ! -e "$WORKSPACE/Tools/bin/GenDepex" -o \
- ! -e "$WORKSPACE/Tools/bin/GenFfsFile" -o \
- ! -e "$WORKSPACE/Tools/bin/GenFvImage" -o \
- ! -e "$WORKSPACE/Tools/bin/GenSection" -o \
- ! -e "$WORKSPACE/Tools/bin/GenTEImage" -o \
- ! -e "$WORKSPACE/Tools/bin/MakeDeps" -o \
- ! -e "$WORKSPACE/Tools/bin/ModifyInf" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ia32" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_Ipf" -o \
- ! -e "$WORKSPACE/Tools/bin/PeiRebase_X64" -o \
- ! -e "$WORKSPACE/Tools/bin/SecApResetVectorFixup" -o \
- ! -e "$WORKSPACE/Tools/bin/SecFixup" -o \
- ! -e "$WORKSPACE/Tools/bin/SetStamp" -o \
- ! -e "$WORKSPACE/Tools/bin/SplitFile" -o \
- ! -e "$WORKSPACE/Tools/bin/StrGather" -o \
- ! -e "$WORKSPACE/Tools/bin/Strip" -o \
- ! -e "$WORKSPACE/Tools/bin/VfrCompile" -o \
- ! -e "$WORKSPACE/Tools/bin/ZeroDebugData" -o \
- ! -e "$WORKSPACE/Tools/bin/antlr" -o \
- ! -e "$WORKSPACE/Tools/bin/dlg" ]
+ #
+ # Set $WORKSPACE
+ #
+ export WORKSPACE=`pwd`
+
+ return 0
+}
+
+function SetupEnv()
+{
+ if [ -n "$EDK_TOOLS_PATH" ]
+ then
+ . $EDK_TOOLS_PATH/BuildEnv $*
+ elif [ -f "$WORKSPACE/BaseTools/BuildEnv" ]
+ then
+ . $WORKSPACE/BaseTools/BuildEnv $*
+ else
+ echo BaseTools not found in your tree, and EDK_TOOLS_PATH is not set.
+ echo Please check that WORKSPACE is not set incorrectly in your
+ echo shell, or point EDK_TOOLS_PATH at the directory that contains
+ echo the EDK2 BuildEnv script.
+ return 1
+ fi
+}
+
+function SourceEnv()
+{
+ if [ \
+ "$1" = "-?" -o \
+ "$1" = "-h" -o \
+ "$1" = "--help" \
+ ]
+ then
+ HelpMsg
+ else
+ SetWorkspace &&
+ SetupEnv "$*"
+ fi
+}
+
+if [ $# -gt 1 ]