diff options
| author | DawnManget <[email protected]> | 2022-05-10 11:22:15 +0800 |
|---|---|---|
| committer | DawnManget <[email protected]> | 2022-05-10 11:22:15 +0800 |
| commit | 78c0715c5b79a2fcd94a8c808bffb22e60533c2b (patch) | |
| tree | a67c677c915778a699689b8ce43c0c59ff88e730 | |
| parent | 8d0fb42d11874dd59bac82b45d1ca81e0df01780 (diff) | |
review2: add keil-c51 toolchain & rules
| -rw-r--r-- | xmake/modules/detect/tools/find_bl51.lua | 9 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_c51.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_oh51.lua | 8 |
3 files changed, 15 insertions, 8 deletions
diff --git a/xmake/modules/detect/tools/find_bl51.lua b/xmake/modules/detect/tools/find_bl51.lua index 001d1ed13..563db1271 100644 --- a/xmake/modules/detect/tools/find_bl51.lua +++ b/xmake/modules/detect/tools/find_bl51.lua @@ -25,17 +25,20 @@ import("lib.detect.find_tool") function _check(program) local c51 = assert(find_tool("c51"), "c51 not found") + -- make temp source file - local tmpdir = os.tmpfile() - os.mkdir(tmpdir) + local tmpdir = os.tmpfile() .. ".dir" local cfile = path.join(tmpdir, "test.c") local objfile = path.join(tmpdir, "test.obj") local binfile = path.join(tmpdir, "test") + -- write test code io.writefile(cfile, "void main() {}") + -- archive it - os.runv(c51.program, {cfile}) + os.runv(c51.program, {"test.c"}, {curdir = tmpdir}) os.runv(program, {objfile, "TO", binfile}) + -- remove files os.rmdir(tmpdir) end diff --git a/xmake/modules/detect/tools/find_c51.lua b/xmake/modules/detect/tools/find_c51.lua index 616b81a4d..743784f1a 100644 --- a/xmake/modules/detect/tools/find_c51.lua +++ b/xmake/modules/detect/tools/find_c51.lua @@ -25,13 +25,13 @@ import("detect.sdks.find_c51") function _check(program) -- make temp source file - local tmpdir = os.tmpfile() - os.mkdir(tmpdir) + local tmpdir = os.tmpfile() .. ".dir" local cfile = path.join(tmpdir, "test.c") + -- write test code io.writefile(cfile, "void main() {}") -- archive it - os.runv(program, {cfile}) + os.runv(program, {"test.c"}, {curdir = tmpdir}) -- remove files os.rmdir(tmpdir) end diff --git a/xmake/modules/detect/tools/find_oh51.lua b/xmake/modules/detect/tools/find_oh51.lua index dc3310efe..f81002a3e 100644 --- a/xmake/modules/detect/tools/find_oh51.lua +++ b/xmake/modules/detect/tools/find_oh51.lua @@ -27,18 +27,22 @@ import("lib.detect.find_tool") function _check(program) local c51 = assert(find_tool("c51"), "c51 not found") local bl51 = assert(find_tool("bl51"), "bl51 not found") + -- make temp source file - local tmpdir = os.tmpfile() + local tmpdir = os.tmpfile() .. ".dir" os.mkdir(tmpdir) local cfile = path.join(tmpdir, "test.c") local objfile = path.join(tmpdir, "test.obj") local binfile = path.join(tmpdir, "test") + -- write test code io.writefile(cfile, "void main() {}") + -- archive it - os.runv(c51.program, {cfile}) + os.runv(c51.program, {"test.c"}, {curdir = tmpdir}) os.runv(bl51.program, {objfile, "TO", binfile}) os.runv(program, {binfile}) + -- remove files os.rmdir(tmpdir) end |
