From: Yingke Liu Date: Tue, 16 Jun 2015 04:23:00 +0000 (+0000) Subject: BaseTools: Fixed a bug to generate correct path of PACKAGE_RELATIVE_PATH X-Git-Tag: edk2-stable201903~9623 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b442ad5c07c2c8f9a13ce22e74edd9eef91f34e3 BaseTools: Fixed a bug to generate correct path of PACKAGE_RELATIVE_PATH Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17642 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 1d49a0316d..0342709a3a 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -555,8 +555,16 @@ cleanlib: LibraryMakeCommandList.append(Command) package_rel_dir = self._AutoGenObject.SourceDir - if os.sep in package_rel_dir: - package_rel_dir = package_rel_dir[package_rel_dir.index(os.sep) + 1:] + current_dir = self.Macros["WORKSPACE"] + found = False + while not found and os.sep in package_rel_dir: + index = package_rel_dir.index(os.sep) + current_dir = os.path.join(current_dir, package_rel_dir[:index]) + for fl in os.listdir(current_dir): + if fl.endswith('.dec'): + found = True + break + package_rel_dir = package_rel_dir[index + 1:] MakefileTemplateDict = { "makefile_header" : self._FILE_HEADER_[self._FileType],