summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-07 00:06:55 +0800
committerruki <[email protected]>2025-12-07 17:15:59 +0800
commit2bbcf01a43b170d346d6776964ea0d5847c822aa (patch)
tree3e6831ffcbaf76d5de857f0f88ec7e8e3939e293
parentd0293d9d840a71b64e5622350fa2e1df0ecff92f (diff)
fix bin2obj ext
-rw-r--r--xmake/rules/utils/bin2obj/xmake.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/xmake/rules/utils/bin2obj/xmake.lua b/xmake/rules/utils/bin2obj/xmake.lua
index df76c42a3..2bdd9c3a8 100644
--- a/xmake/rules/utils/bin2obj/xmake.lua
+++ b/xmake/rules/utils/bin2obj/xmake.lua
@@ -23,14 +23,6 @@ rule("utils.bin2obj")
add_orders("utils.bin2obj", "c++.build.modules.builder")
on_buildcmd_file(function (target, batchcmds, sourcefile_bin, opt)
- -- get object file
- local objectfile = path.join(target:objectdir(), path.basename(sourcefile_bin) .. ".o")
- table.insert(target:objectfiles(), objectfile)
-
- -- add commands
- batchcmds:show_progress(opt.progress, "${color.build.object}generating.bin2obj %s", sourcefile_bin)
- batchcmds:mkdir(path.directory(objectfile))
-
-- get format (default: auto-detect from platform)
local format = target:extraconf("rules", "utils.bin2obj", "format")
if not format then
@@ -43,6 +35,15 @@ rule("utils.bin2obj")
end
end
+ -- get object file (use .obj for COFF, .o for others)
+ local objext = (format == "coff") and ".obj" or ".o"
+ local objectfile = path.join(target:objectdir(), path.basename(sourcefile_bin) .. objext)
+ table.insert(target:objectfiles(), objectfile)
+
+ -- add commands
+ batchcmds:show_progress(opt.progress, "${color.build.object}generating.bin2obj %s", sourcefile_bin)
+ batchcmds:mkdir(path.directory(objectfile))
+
-- get symbol prefix (default: _binary_)
local symbol_prefix = target:extraconf("rules", "utils.bin2obj", "symbol_prefix") or "_binary_"