summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-29 16:35:57 +0800
committerGitHub <[email protected]>2023-11-29 16:35:57 +0800
commit682a85ebfd9dd8b9c4abb18d23938a3f9a107f16 (patch)
tree2f8c61c4865db5be455f6736c9adb852a10051c3
parent2c254f67bb836f94170e714e56382b7bd44e6541 (diff)
parent10383e2461f5669a355308ae2b9e707a12b9daa1 (diff)
Merge pull request #4446 from Guyutongxue/patch-1
Fix `asn1c` rule
-rw-r--r--xmake/rules/asn1c/xmake.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/xmake/rules/asn1c/xmake.lua b/xmake/rules/asn1c/xmake.lua
index cc1c60dd0..e249fd825 100644
--- a/xmake/rules/asn1c/xmake.lua
+++ b/xmake/rules/asn1c/xmake.lua
@@ -31,18 +31,22 @@ rule("asn1c")
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.asn1c %s", sourcefile_asn1)
batchcmds:mkdir(sourcefile_dir)
batchcmds:vrunv(asn1c.program, {path(sourcefile_asn1):absolute()}, {curdir = sourcefile_dir})
+ batchcmds:add_depfiles(sourcefile_asn1)
+ batchcmds:set_depcache(target:dependfile(sourcefile_asn1))
+
+ -- add includedirs
+ target:add("includedirs", sourcefile_dir)
+ end)
+
+ on_buildcmd_file(function (target, batchcmds, sourcefile_asn1, opt)
-- compile *.c
+ local sourcefile_dir = path.join(target:autogendir(), "rules", "asn1c")
for _, sourcefile in ipairs(os.files(path.join(sourcefile_dir, "*.c|converter-*.c"))) do
local objectfile = target:objectfile(sourcefile)
batchcmds:compile(sourcefile, objectfile, {configs = {includedirs = sourcefile_dir}})
table.insert(target:objectfiles(), objectfile)
+ batchcmds:add_depfiles(sourcefile)
end
-
- -- add includedirs
- target:add("includedirs", sourcefile_dir)
-
- -- add deps
- batchcmds:add_depfiles(sourcefile_asn1)
- batchcmds:set_depcache(target:dependfile(sourcefile_asn1))
+ batchcmds:set_depcache(target:dependfile(sourcefile_asn1 .. ".c"))
end)