diff options
| author | ruki <[email protected]> | 2017-07-05 09:19:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-05 09:20:11 +0800 |
| commit | 2dc9b33e513e906f6b7b31f0df6b20f518924774 (patch) | |
| tree | 205fb2bb51ece7771c43bd4a9ac3da9cd5593c9d | |
| parent | 4058f49432cd95263b8880960ab356bc8bcd96d0 (diff) | |
improve to link targets if objects and deps are not changed
| -rw-r--r-- | xmake/actions/build/builder.lua | 3 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/binary.lua | 15 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/object.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/shared.lua | 15 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/static.lua | 15 |
5 files changed, 41 insertions, 11 deletions
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua index df4ed8322..d8a4e4185 100644 --- a/xmake/actions/build/builder.lua +++ b/xmake/actions/build/builder.lua @@ -135,6 +135,9 @@ function build(targetname) -- clear finished states _g.finished = {} + -- clear modified states + _g.modified = {} + -- init target index _g.targetindex = 0 diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua index 52baad2a3..78ca5996d 100644 --- a/xmake/actions/build/kinds/binary.lua +++ b/xmake/actions/build/kinds/binary.lua @@ -34,9 +34,18 @@ function _build_from_objects(target, buildinfo) -- build objects object.build(target, buildinfo) - -- the object files are not modified? - if not buildinfo.objects_modified then - return + -- this target and it's deps are not modified? + local modified = buildinfo.modified[target:name()] + if not modified then + for _, depname in ipairs(target:get("deps")) do + modified = buildinfo.modified[depname] + if modified then + break + end + end + if not modified then + return + end end -- expand object files with *.o/obj diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua index 513cb2b9e..4acb9f863 100644 --- a/xmake/actions/build/kinds/object.lua +++ b/xmake/actions/build/kinds/object.lua @@ -140,8 +140,8 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache) return end - -- the object files are modified - buildinfo.objects_modified = true + -- mark this target as modified + buildinfo.modified[target:name()] = true -- is verbose? local verbose = option.get("verbose") diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua index d4fa90257..3cbcea9c8 100644 --- a/xmake/actions/build/kinds/shared.lua +++ b/xmake/actions/build/kinds/shared.lua @@ -34,9 +34,18 @@ function _build_from_objects(target, buildinfo) -- build objects object.build(target, buildinfo) - -- the object files are not modified? - if not buildinfo.objects_modified then - return + -- this target and it's deps are not modified? + local modified = buildinfo.modified[target:name()] + if not modified then + for _, depname in ipairs(target:get("deps")) do + modified = buildinfo.modified[depname] + if modified then + break + end + end + if not modified then + return + end end -- make headers diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua index 9b73742a3..9682c3846 100644 --- a/xmake/actions/build/kinds/static.lua +++ b/xmake/actions/build/kinds/static.lua @@ -34,9 +34,18 @@ function _build_from_objects(target, buildinfo) -- build objects object.build(target, buildinfo) - -- the object files are not modified? - if not buildinfo.objects_modified then - return + -- this target and it's deps are not modified? + local modified = buildinfo.modified[target:name()] + if not modified then + for _, depname in ipairs(target:get("deps")) do + modified = buildinfo.modified[depname] + if modified then + break + end + end + if not modified then + return + end end -- make headers |
