## @file\r
# The engine for building files\r
#\r
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
##\r
# Import Modules\r
#\r
-import os\r
+import Common.LongFilePathOs as os\r
import re\r
import copy\r
import string\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
\r
from Common.GlobalData import *\r
from Common.BuildToolError import *\r
#\r
# @retval tuple (Source file in full path, List of individual sourcefiles, Destionation file, List of build commands)\r
#\r
- def Apply(self, SourceFile):\r
+ def Apply(self, SourceFile, BuildRuleOrder=None):\r
if not self.CommandList or not self.DestFileList:\r
return None\r
\r
\r
if DstFile[0] in self.BuildTargets:\r
TargetDesc = self.BuildTargets[DstFile[0]]\r
- TargetDesc.AddInput(SourceFile)\r
+ if BuildRuleOrder and SourceFile.Ext in BuildRuleOrder:\r
+ Index = BuildRuleOrder.index(SourceFile.Ext)\r
+ for Input in TargetDesc.Inputs:\r
+ if Input.Ext not in BuildRuleOrder or BuildRuleOrder.index(Input.Ext) > Index:\r
+ #\r
+ # Command line should be regenerated since some macros are different\r
+ #\r
+ CommandList = self._BuildCommand(BuildRulePlaceholderDict)\r
+ TargetDesc._Init([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
+ break\r
+ else:\r
+ TargetDesc.AddInput(SourceFile)\r
else:\r
- CommandList = []\r
- for CommandString in self.CommandList:\r
- CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict)\r
- CommandString = string.Template(CommandString).safe_substitute(BuildRulePlaceholderDict)\r
- CommandList.append(CommandString)\r
+ CommandList = self._BuildCommand(BuildRulePlaceholderDict)\r
TargetDesc = TargetDescBlock([SourceFile], DstFile, CommandList, self.ExtraSourceFileList)\r
TargetDesc.ListFileMacro = self.ListFileMacro\r
TargetDesc.FileListMacro = self.FileListMacro\r
self.BuildTargets[DstFile[0]] = TargetDesc\r
return TargetDesc\r
\r
+ def _BuildCommand(self, Macros):\r
+ CommandList = []\r
+ for CommandString in self.CommandList:\r
+ CommandString = string.Template(CommandString).safe_substitute(Macros)\r
+ CommandString = string.Template(CommandString).safe_substitute(Macros)\r
+ CommandList.append(CommandString)\r
+ return CommandList\r
+\r
## Class for build rules\r
#\r
# BuildRule class parses rules defined in a file or passed by caller, and converts\r