summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-05-13 22:43:54 +0800
committerruki <[email protected]>2018-05-13 22:43:54 +0800
commit759526b426ad0350ece0194871ac2aa3af564841 (patch)
tree08c25a7fa73b13a5f8c7feb3a335426e076cc36c
parent785a6f3054395d17db85812896308ec5cd27691c (diff)
fix wdk.inf rule
-rw-r--r--tests/projects/wdk/kmdf/msdsm/xmake.lua5
-rw-r--r--xmake/rules/wdk/inf/xmake.lua81
-rw-r--r--xmake/rules/wdk/mc/xmake.lua2
3 files changed, 29 insertions, 59 deletions
diff --git a/tests/projects/wdk/kmdf/msdsm/xmake.lua b/tests/projects/wdk/kmdf/msdsm/xmake.lua
index e765c1d43..b706a9daf 100644
--- a/tests/projects/wdk/kmdf/msdsm/xmake.lua
+++ b/tests/projects/wdk/kmdf/msdsm/xmake.lua
@@ -8,7 +8,10 @@ target("msdsm")
-- add rules
add_rules("wdk.kmdf.driver")
+ -- add flags for rule: wdk.tracewpp
+ add_values("wdk.tracewpp.flags", "-func:TracePrint((LEVEL,FLAGS,MSG,...))")
+
-- add files
- add_files("*.c")
+ add_files("*.c", {rule = "wdk.tracewpp"})
add_files("*.mof", "*.rc", "*.inf")
diff --git a/xmake/rules/wdk/inf/xmake.lua b/xmake/rules/wdk/inf/xmake.lua
index d612e51ea..3cec2660b 100644
--- a/xmake/rules/wdk/inf/xmake.lua
+++ b/xmake/rules/wdk/inf/xmake.lua
@@ -22,14 +22,14 @@
-- @file xmake.lua
--
--- define rule: *.mc
-rule("wdk.mc")
+-- define rule: *.inf
+rule("wdk.inf")
-- add rule: wdk environment
add_deps("wdk.env")
-- set extensions
- set_extensions(".mc")
+ set_extensions(".inf", ".inx")
-- on load
on_load(function (target)
@@ -40,81 +40,50 @@ rule("wdk.mc")
-- get arch
local arch = assert(config.arch(), "arch not found!")
- -- get mc
- local mc = path.join(target:data("wdk").bindir, arch, is_host("windows") and "mc.exe" or "mc")
- assert(mc and os.isexec(mc), "mc not found!")
+ -- get stampinf
+ local stampinf = path.join(target:data("wdk").bindir, arch, is_host("windows") and "stampinf.exe" or "stampinf")
+ assert(stampinf and os.isexec(stampinf), "stampinf not found!")
- -- save mc
- target:data_set("wdk.mc", mc)
-
- -- save output directory
- target:data_set("wdk.mc.outputdir", path.join(config.buildir(), ".wdk", "mc", config.get("mode") or "generic", config.get("arch") or os.arch(), target:name()))
+ -- save uic
+ target:data_set("wdk.stampinf", stampinf)
end)
- -- before build file
- before_build_file(function (target, sourcefile, opt)
+ -- on build file
+ on_build_file(function (target, sourcefile, opt)
-- imports
import("core.base.option")
import("core.project.depend")
- -- get mc
- local mc = target:data("wdk.mc")
-
- -- get output directory
- local outputdir = target:data("wdk.mc.outputdir")
-
- -- init args
- local args = {}
- local flags = target:values("wdk.mc.flags")
- if flags then
- table.join2(args, flags)
- end
- table.insert(args, "-h")
- table.insert(args, outputdir)
- table.insert(args, "-r")
- table.insert(args, outputdir)
-
- -- add header file
- local header = target:values("wdk.mc.header")
- local headerfile = header and path.join(outputdir, header) or nil
- if headerfile then
- table.insert(args, "-z")
- table.insert(args, path.basename(headerfile))
- target:data_add("wdk.cleanfiles", headerfile)
- else
- headerfile = path.join(outputdir, path.basename(sourcefile) .. ".h")
- end
-
- -- add source file
- table.insert(args, sourcefile)
+ -- the target file
+ local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".inf")
- -- add includedirs
- target:add("includedirs", outputdir)
+ -- add clean files
+ target:data_add("wdk.cleanfiles", targetfile)
-- need build this object?
- local dependfile = target:dependfile(headerfile)
+ local dependfile = target:dependfile(targetfile)
local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {})
- if not depend.is_changed(dependinfo, {lastmtime = os.mtime(headerfile), values = args}) then
+ if not depend.is_changed(dependinfo, {lastmtime = os.mtime(targetfile)}) then
return
end
-- trace progress info
if option.get("verbose") then
- cprint("${green}[%02d%%]:${dim} compiling.wdk.mc %s", opt.progress, sourcefile)
+ cprint("${green}[%02d%%]:${dim} compiling.wdk.inf %s", opt.progress, sourcefile)
else
- cprint("${green}[%02d%%]:${clear} compiling.wdk.mc %s", opt.progress, sourcefile)
+ cprint("${green}[%02d%%]:${clear} compiling.wdk.inf %s", opt.progress, sourcefile)
end
- -- do message compile
- if not os.isdir(outputdir) then
- os.mkdir(outputdir)
- end
- os.vrunv(mc, args)
+ -- get stampinf
+ local stampinf = target:data("wdk.stampinf")
+
+ -- update the timestamp
+ os.cp(sourcefile, targetfile)
+ os.vrunv(stampinf, {"-d", "*", "-a", is_arch("x64") and "arm64" or "x86", "-v", "*", "-f", targetfile}, {wildcards = false})
-- update files and values to the dependent file
- dependinfo.files = {sourcefile}
- dependinfo.values = args
+ dependinfo.files = {sourcefile}
depend.save(dependinfo, dependfile)
end)
diff --git a/xmake/rules/wdk/mc/xmake.lua b/xmake/rules/wdk/mc/xmake.lua
index 3765bf151..a3550cedd 100644
--- a/xmake/rules/wdk/mc/xmake.lua
+++ b/xmake/rules/wdk/mc/xmake.lua
@@ -85,8 +85,6 @@ rule("wdk.mc")
if headerfile then
table.insert(args, "-z")
table.insert(args, path.basename(headerfile))
- table.insert(args, "-e")
- table.insert(args, path.extension(headerfile))
target:data_add("wdk.cleanfiles", headerfile)
else
headerfile = path.join(outputdir, path.basename(sourcefile) .. ".h")