diff options
| author | Jack <[email protected]> | 2022-12-29 22:40:29 +0800 |
|---|---|---|
| committer | Jack <[email protected]> | 2022-12-29 22:40:29 +0800 |
| commit | ef32bc5e2afd606eab6db1b2b02292a2ee2e89c4 (patch) | |
| tree | 62f13c6ff605c32a641fe080b33b3a4b4813c06a /xmake/modules/core/tools | |
| parent | da9f602edda385b219c6982658533ac9dc41af2a (diff) | |
Fix includedir invalid issue #3215
Diffstat (limited to 'xmake/modules/core/tools')
| -rw-r--r-- | xmake/modules/core/tools/c51.lua | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/xmake/modules/core/tools/c51.lua b/xmake/modules/core/tools/c51.lua index c172d0bb6..af87661b4 100644 --- a/xmake/modules/core/tools/c51.lua +++ b/xmake/modules/core/tools/c51.lua @@ -28,13 +28,20 @@ import("utils.progress") function init(self) end +--[[ +The flags variable in the compile function is empty when you run the command `xmake -r`. +But The `xmake -rv` command is no problem. +Use these ways to walk around first. +--]] +local paths = {} + -- make the includedir flag function nf_includedirs(self, dirs) - local paths = {} +-- local paths = {} for _, dir in ipairs(dirs) do table.insert(paths, path.translate(dir)) end - if #paths > 0 then + if #paths > 0 then return {"INCDIR(" .. table.concat(paths, ";") .. ")"} end end @@ -48,7 +55,12 @@ end -- make the compile arguments list function compargv(self, sourcefile, objectfile, flags) - return self:program(), table.join(sourcefile, flags) + table.insert(flags, 1, "OBJECT(" .. objectfile .. ")") + table.insert(flags, 2, "PRINT(" .. objectfile:gsub(".c.obj", ".lst") .. ")") + if #paths > 0 then + table.insert(flags, 3, "INCDIR(" .. table.concat(paths, ";") .. ")") + end + return self:program(), table.join(sourcefile, flags) end -- compile the source file @@ -56,14 +68,11 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) -- ensure the object directory os.mkdir(path.directory(objectfile)) - -- compile it try { function () - local realsourcefile = objectfile:gsub("\\.obj$", "") - os.cp(sourcefile, realsourcefile) - local outdata, errdata = os.iorunv(compargv(self, realsourcefile, objectfile, dependinfo, flags)) + local outdata, errdata = os.iorunv(compargv(self, sourcefile, objectfile, dependinfo, flags)) return (outdata or "") .. (errdata or "") end, catch |
