public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Steven Shi" <steven.shi@intel.com>
To: devel@edk2.groups.io
Cc: bob.c.feng@intel.com, yuwei.chen@intel.com, ardb@kernel.org,
	leif@nuviainc.com, abner.chang@hpe.com, daniel.schaefer@hpe.com,
	Steven Shi <steven.shi@intel.com>
Subject: [PATCH 1/1] BaseTools: Enable GNU make parallel jobs by default
Date: Mon, 17 Jan 2022 22:42:51 +0800	[thread overview]
Message-ID: <20220117144251.1087-2-steven.shi@intel.com> (raw)
In-Reply-To: <20220117144251.1087-1-steven.shi@intel.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3807

* Enable GNU make parallel jobs support(--jobs flag) by
  default in GCC5 and CLANGPDB toolchains. This gmake flag
  can save full features bios linux build time by +20%.
* Explictly distinguish and define the MS nmake flag and
  GNU gmake flag in the toolchain which might support
  both, e.g. CLANGPDB can use nmake in Windows and gmake
  in Linux. General make flags cannot work for such hybrid
  make usage scenario.

Signed-off-by: Steven Shi <steven.shi@intel.com>
---
 BaseTools/Conf/tools_def.template                  |  4 ++++
 BaseTools/Source/Python/AutoGen/GenMake.py         |  5 +++--
 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 12 +++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 2e6b382ab623..84af08cca6ae 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -2283,6 +2283,8 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
 *_GCC5_*_*_FAMILY                = GCC
 
 *_GCC5_*_MAKE_PATH               = DEF(GCC_HOST_PREFIX)make
+*_GCC5_*_GMAKE_FLAGS             = --jobs
+*_GCC5_*_NMAKE_FLAGS             = /nologo
 *_GCC5_*_*_DLL                   = ENV(GCC5_DLL)
 *_GCC5_*_ASL_PATH                = DEF(UNIX_IASL_BIN)
 
@@ -2742,6 +2744,8 @@ RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl
 *_CLANGPDB_*_*_FAMILY                = GCC
 *_CLANGPDB_*_*_BUILDRULEFAMILY       = CLANGPDB
 *_CLANGPDB_*_MAKE_PATH               = ENV(CLANG_HOST_BIN)make
+*_CLANGPDB_*_GMAKE_FLAGS             = --jobs
+*_CLANGPDB_*_NMAKE_FLAGS             = /nologo
 *_CLANGPDB_*_*_DLL                   = ENV(CLANGPDB_DLL)
 *_CLANGPDB_*_ASL_PATH                = DEF(UNIX_IASL_BIN)
 
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index e55efff059f9..c6636d99fc7d 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -732,10 +732,11 @@ cleanlib:
                     Src, Dst = CopyCmd
                     Src = self.ReplaceMacro(Src)
                     Dst = self.ReplaceMacro(Dst)
+                    Efi = Src[:-3] + 'efi'
                     if Dst not in self.ResultFileList:
                         self.ResultFileList.append(Dst)
                     if '%s :' %(Dst) not in self.BuildTargetList:
-                        self.BuildTargetList.append("%s : %s" %(Dst,Src))
+                        self.BuildTargetList.append("%s : %s" %(Dst, Efi))
                         self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._Platform] %{'Src': Src, 'Dst': Dst})
 
             FfsCmdList = Cmd[0]
@@ -778,7 +779,7 @@ cleanlib:
                                 SecDepsFileList.append(SecCmdList[index + 1])
                             index = index + 1
                         if CmdName == 'Trim':
-                            SecDepsFileList.append(os.path.join('$(DEBUG_DIR)', os.path.basename(OutputFile).replace('offset', 'efi')))
+                            SecDepsFileList.append(os.path.join('$(OUTPUT_DIR)', os.path.basename(OutputFile).replace('offset', 'efi')))
                         if OutputFile.endswith('.ui') or OutputFile.endswith('.ver'):
                             SecDepsFileList.append(os.path.join('$(MODULE_DIR)', '$(MODULE_FILE)'))
                         self.FfsOutputFileList.append((OutputFile, ' '.join(SecDepsFileList), SecCmdStr))
diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index 592d4824a4b3..632c960c8d3d 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -893,7 +893,17 @@ class PlatformAutoGen(AutoGen):
                 RetVal[Tool] = OrderedDict()
             if Attr not in RetVal[Tool]:
                 RetVal[Tool][Attr] = Value
-
+        if 'NMAKE' in RetVal.keys() or 'GMAKE' in RetVal.keys():
+            if RetVal['MAKE']['PATH'] == "nmake":
+                if 'FLAGS' in RetVal['MAKE'].keys():
+                    RetVal['MAKE']['FLAGS'] += ' ' + RetVal['NMAKE']['FLAGS']
+                else:
+                    RetVal['MAKE']['FLAGS'] = RetVal['NMAKE']['FLAGS']
+            else:
+                if 'FLAGS' in RetVal['MAKE'].keys():
+                    RetVal['MAKE']['FLAGS'] += ' ' + RetVal['GMAKE']['FLAGS']
+                else:
+                    RetVal['MAKE']['FLAGS'] = RetVal['GMAKE']['FLAGS']
         ToolsDef = ''
         if GlobalData.gOptions.SilentMode and "MAKE" in RetVal:
             if "FLAGS" not in RetVal["MAKE"]:
-- 
2.22.0.windows.1


  reply	other threads:[~2022-01-17 14:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 14:42 [PATCH 0/1] Enable GNU make parallel jobs by default for GCC5 and CLANGPDB ToolChains Steven Shi
2022-01-17 14:42 ` Steven Shi [this message]
2022-01-17 14:54   ` [PATCH 1/1] BaseTools: Enable GNU make parallel jobs by default Steven Shi
2022-01-19 10:52     ` [edk2-devel] " Steven Shi
2022-01-19 15:03       ` Abner Chang
2022-01-27  3:00   ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220117144251.1087-2-steven.shi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox