diff options
| author | ruki <[email protected]> | 2021-10-16 00:22:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-16 00:22:16 +0800 |
| commit | fceae198e53036fce3dd179cadabafe991c6ea0b (patch) | |
| tree | d8552aab0095a10dac36312d6c92c9196780aee4 | |
| parent | 9d707e01104fe21569b9354ff1a8191f27d5b43a (diff) | |
improve gcc/parse_deps
| -rw-r--r-- | xmake/modules/private/tools/gcc/parse_deps.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/modules/private/tools/gcc/parse_deps.lua b/xmake/modules/private/tools/gcc/parse_deps.lua index cb06d091c..606e6c840 100644 --- a/xmake/modules/private/tools/gcc/parse_deps.lua +++ b/xmake/modules/private/tools/gcc/parse_deps.lua @@ -54,9 +54,18 @@ end -- src/tbox/libc/string/../../prefix/../config.h \ -- build/iphoneos/x86_64/release/tbox.config.h \ -- +-- with c++ modules: +-- build/.objs/dependence/linux/x86_64/release/src/foo.mpp.o: src/foo.mpp\ +-- build/.objs/dependence/linux/x86_64/release/src/foo.mpp.o gcm.cache/foo.gcm: bar.c++m cat.c++m\ +-- foo.c++m: gcm.cache/foo.gcm\ +-- .PHONY: foo.c++m\ +-- gcm.cache/foo.gcm:| build/.objs/dependence/linux/x86_64/release/src/foo.mpp.o\ +-- CXX_IMPORTS += bar.c++m cat.c++m\ +-- function main(depsdata) -- we assume there is only one valid line + local block = 0 local results = hashset.new() local projectdir = os.projectdir() local line = depsdata:rtrim() -- maybe there will be an empty newline at the end. so we trim it first @@ -68,8 +77,15 @@ function main(depsdata) if is_host("windows") and includefile:match("^%w\\:") then includefile = includefile:replace("\\:", ":", plain) end - if not includefile:endswith(":") then -- ignore "xxx.o:" prefix + if includefile:endswith(":") then -- ignore "xxx.o:" prefix + block = block + 1 + if block > 1 then + -- skip other `xxx.o:` block + break + end + else includefile = includefile:replace(space_placeholder, ' ', plain) + includefile = includefile:split("\n")[1] if #includefile > 0 then includefile = _normailize_dep(includefile, projectdir) if includefile then |
