diff options
| author | ruki <[email protected]> | 2021-10-07 00:47:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-07 00:47:50 +0800 |
| commit | c360a739ba17f89f7f4d4f8ffbebc30576cd7dea (patch) | |
| tree | ffb7d9c080f79a7af30287c8a4b13a23c3ddd80b /xmake/modules/package/tools/autoconf.lua | |
| parent | e788a3a67cee9a162cecbfc599bdddcfd78879a9 (diff) | |
improve make for tools/make/autoconf
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index b0607ac0d..f06a18bb0 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -23,6 +23,7 @@ import("core.base.option") import("core.project.config") import("core.tool.linker") import("core.tool.compiler") +import("lib.detect.find_tool") -- translate path function _translate_path(package, p) @@ -296,8 +297,25 @@ function configure(package, configs, opt) os.vrunv("sh", argv, {envs = envs}) end --- install package -function install(package, configs, opt) +-- do make +function make(package, argv, opt) + opt = opt or {} + local program + if package:is_plat("mingw") and is_subhost("windows") then + local mingw = assert(package:build_getenv("mingw") or package:build_getenv("sdk"), "mingw not found!") + program = path.join(mingw, "bin", "mingw32-make.exe") + else + local tool = find_tool("make") + if tool then + program = tool.program + end + end + assert(program, "make not found!") + os.vrunv(program, argv) +end + +-- build package +function build(package, configs, opt) -- do configure configure(package, configs, opt) @@ -309,12 +327,21 @@ function install(package, configs, opt) if option.get("verbose") then table.insert(argv, "V=1") end - if is_host("bsd") then - os.vrunv("gmake", argv) - os.vrun("gmake install") - else - os.vrunv("make", argv) - os.vrun("make install") + make(package, argv, opt) +end + +-- install package +function install(package, configs, opt) + + -- do build + opt = opt or {} + build(package, configs, opt) + + -- do install + local argv = {"install"} + if option.get("verbose") then + table.insert(argv, "V=1") end + make(package, argv, opt) end |
