summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/make.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-07 23:49:05 +0800
committerruki <[email protected]>2020-04-07 16:54:34 +0800
commit088df3a0bbe2bd99b5d60a5a1f5fb54d4be1673d (patch)
tree316d3c3aeaeccd20e8ace1435a7badaf76069a48 /xmake/modules/package/tools/make.lua
parent20b25b2a16d0282b0496f23d0f0e1ba8842b9205 (diff)
support m32 for autoconf and make
Diffstat (limited to 'xmake/modules/package/tools/make.lua')
-rw-r--r--xmake/modules/package/tools/make.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua
index 5e8d494c3..5a9f06be5 100644
--- a/xmake/modules/package/tools/make.lua
+++ b/xmake/modules/package/tools/make.lua
@@ -19,6 +19,7 @@
--
-- imports
+import("core.base.option")
import("core.project.config")
-- get the build environments
@@ -27,9 +28,18 @@ function buildenvs(package)
if package:is_plat(os.host()) then
local cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags"))
local cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags"))
+ local asflags = table.copy(table.wrap(package:config("asflags")))
+ local ldflags = table.copy(table.wrap(package:config("ldflags")))
+ if package:is_plat("linux") and package:is_arch("i386") then
+ table.insert(cflags, "-m32")
+ table.insert(cxxflags, "-m32")
+ table.insert(asflags, "-m32")
+ table.insert(ldflags, "-m32")
+ end
envs.CFLAGS = table.concat(cflags, ' ')
envs.CXXFLAGS = table.concat(cxxflags, ' ')
- envs.ASFLAGS = table.concat(table.wrap(package:config("asflags")), ' ')
+ envs.ASFLAGS = table.concat(asflags, ' ')
+ envs.LDFLAGS = table.concat(ldflags, ' ')
else
local cflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cflags"))
local cxxflags = table.join(table.wrap(package:build_getenv("cxflags")), package:build_getenv("cxxflags"))
@@ -71,7 +81,11 @@ function build(package, configs, opt)
opt = opt or {}
-- pass configurations
- local argv = {"-j4"}
+ local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local argv = {"-j" .. njob}
+ if option.get("verbose") then
+ table.insert(argv, "VERBOSE=1")
+ end
for name, value in pairs(configs) do
value = tostring(value):trim()
if value ~= "" then