summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)