summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/build
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-03-16 11:06:44 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2016-03-22 17:16:49 +0800
commit725cdb8fbfb034cd73574ed9c356b0dca14ff843 (patch)
tree499ecaa00449ca43e94a549f0802db955212966e /BaseTools/Source/Python/build
parent3362c5f17a3af3151b30f895c2c13fc0280a7ad3 (diff)
downloadedk2-platforms-725cdb8fbfb034cd73574ed9c356b0dca14ff843.tar.xz
BaseTools: Fix nmake failure due to command-line length limitation
NMAKE is limited to command-line length of 4096 characters. Due to the large number of /I directives specified on command line (one per include directory), the path length of WORKSPACE is multiplied by the number of /I directives and can exceed the limit. This patch: 1. Add new build option -l, --cmd-len to set the maximum command line length, default value is 4096. 2. Generate the response file only if the command line length exceed its maximum characters (default is 4096) when build the module. Cover PP_FLAGS, CC_FLAGS, VFRPP_FLAGS, APP_FLAGS, ASLPP_FLAGS, ASLCC_FLAGS and ASM_FLAGS. 3. The content of the response file is combine from the FLAGS option and INC option. 4. When build failure, it would print out the response file's file location and its content. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/build')
-rw-r--r--BaseTools/Source/Python/build/build.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 5619638bd8..5c1fda1a93 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -304,6 +304,14 @@ def LaunchCommand(Command, WorkingDir):
if Proc.returncode != 0:
if type(Command) != type(""):
Command = " ".join(Command)
+ # print out the Response file and its content when make failure
+ RespFile = os.path.join(WorkingDir, 'OUTPUT', 'respfilelist.txt')
+ if os.path.isfile(RespFile):
+ f = open(RespFile)
+ RespContent = f.read()
+ f.close()
+ EdkLogger.info(RespContent)
+
EdkLogger.error("build", COMMAND_FAILURE, ExtraData="%s [%s]" % (Command, WorkingDir))
## The smallest unit that can be built in multi-thread build mode
@@ -775,6 +783,9 @@ class Build():
self.UniFlag = BuildOptions.Flag
self.BuildModules = []
+ if BuildOptions.CommandLength:
+ GlobalData.gCommandMaxLength = BuildOptions.CommandLength
+
# print dot character during doing some time-consuming work
self.Progress = Utils.Progressor()
@@ -1931,6 +1942,7 @@ def MyOptionParser():
Parser.add_option("--check-usage", action="store_true", dest="CheckUsage", default=False, help="Check usage content of entries listed in INF file.")
Parser.add_option("--ignore-sources", action="store_true", dest="IgnoreSources", default=False, help="Focus to a binary build and ignore all source files")
Parser.add_option("--pcd", action="append", dest="OptionPcd", help="Set PCD value by command line. Format: 'PcdName=Value' ")
+ Parser.add_option("-l", "--cmd-len", action="store", type="int", dest="CommandLength", help="Specify the maximum line length of build command. Default is 4096.")
(Opt, Args) = Parser.parse_args()
return (Opt, Args)