summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2016-01-06 10:21:39 +0800
committerruki <[email protected]>2016-01-06 10:21:39 +0800
commitb883a25c05116468adcc9e6d6c4cd69afb28e253 (patch)
tree55fa10b35410c715ed788427800b9edeafa5dec3 /xmake/scripts
parent0a77bcb2dd1ea4e6ade9b95befc3a2f008702c79 (diff)
add --jobs arguments
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/base/main.lua1
-rw-r--r--xmake/scripts/tools/make.lua16
2 files changed, 14 insertions, 3 deletions
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua
index 8e3773f82..5c7c2d188 100644
--- a/xmake/scripts/base/main.lua
+++ b/xmake/scripts/base/main.lua
@@ -68,6 +68,7 @@ local menu =
, {}
+ , {'j', "jobs", "kv", "4", "Specifies the number of jobs to build simultaneously" }
, {'v', "verbose", "k", nil, "Print lots of verbose information." }
, {nil, "version", "k", nil, "Print the version number and exit." }
, {'h', "help", "k", nil, "Print this help message and exit." }
diff --git a/xmake/scripts/tools/make.lua b/xmake/scripts/tools/make.lua
index b16d4880c..5d2d1f42b 100644
--- a/xmake/scripts/tools/make.lua
+++ b/xmake/scripts/tools/make.lua
@@ -41,19 +41,29 @@ end
-- the main function
function make.main(self, mkfile, target)
+ -- enable jobs?
+ local jobs = ""
+ if xmake._OPTIONS.jobs ~= nil then
+ if tonumber(xmake._OPTIONS.jobs) ~= 0 then
+ jobs = "-j" .. xmake._OPTIONS.jobs
+ else
+ jobs = "-j"
+ end
+ end
+
-- make command
local cmd = nil
if mkfile and os.isfile(mkfile) then
- cmd = string.format("%s -r -j4 -f %s %s VERBOSE=%s", self.name, mkfile, target or "", self._VERBOSE)
+ cmd = string.format("%s -r %s -f %s %s VERBOSE=%s", self.name, jobs, mkfile, target or "", self._VERBOSE)
else
- cmd = string.format("%s -r -j4 %s VERBOSE=%s", self.name, target or "", self._VERBOSE)
+ cmd = string.format("%s -r %s %s VERBOSE=%s", self.name, jobs, target or "", self._VERBOSE)
end
-- done
local ok = os.execute(cmd)
if ok ~= 0 then
- -- attempt to execute it again for getting the error logs without -j4
+ -- attempt to execute it again for getting the error logs without jobs
if mkfile and os.isfile(mkfile) then
cmd = string.format("%s -r -f %s %s VERBOSE=%s", self.name, mkfile, target or "", self._VERBOSE)
else