summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/build/kinds/binary.lua21
-rw-r--r--xmake/actions/build/kinds/shared.lua21
-rw-r--r--xmake/actions/build/kinds/static.lua22
3 files changed, 24 insertions, 40 deletions
diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua
index 0ef42ff49..38fb73bc6 100644
--- a/xmake/actions/build/kinds/binary.lua
+++ b/xmake/actions/build/kinds/binary.lua
@@ -36,23 +36,16 @@ function _do_link_target(target, opt)
-- get link flags
local linkflags = linkinst:linkflags({target = target})
- -- expand object files with *.o/obj
- local objectfiles = {}
- for _, objectfile in ipairs(target:objectfiles()) do
- if objectfile:find("*", 1, true) then
- local matchfiles = os.match(objectfile)
- if matchfiles then
- table.join2(objectfiles, matchfiles)
- end
- else
- table.insert(objectfiles, objectfile)
- end
- end
+ -- get object files
+ local objectfiles = target:objectfiles()
-- need build this target?
- local depfiles = target:objectfiles()
- for _, dep in pairs(target:deps()) do
+ local depfiles = objectfiles
+ for _, dep in ipairs(target:orderdeps()) do
if dep:targetkind() == "static" then
+ if depfiles == objectfiles then
+ depfiles = table.copy(objectfiles)
+ end
table.insert(depfiles, dep:targetfile())
end
end
diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua
index ae7b7d523..2a07ad779 100644
--- a/xmake/actions/build/kinds/shared.lua
+++ b/xmake/actions/build/kinds/shared.lua
@@ -36,23 +36,16 @@ function _do_link_target(target, opt)
-- get link flags
local linkflags = linkinst:linkflags({target = target})
- -- expand object files with *.o/obj
- local objectfiles = {}
- for _, objectfile in ipairs(target:objectfiles()) do
- if objectfile:find("*", 1, true) then
- local matchfiles = os.match(objectfile)
- if matchfiles then
- table.join2(objectfiles, matchfiles)
- end
- else
- table.insert(objectfiles, objectfile)
- end
- end
+ -- get object files
+ local objectfiles = target:objectfiles()
-- need build this target?
- local depfiles = target:objectfiles()
- for _, dep in pairs(target:deps()) do
+ local depfiles = objectfiles
+ for _, dep in ipairs(target:orderdeps()) do
if dep:targetkind() == "static" then
+ if depfiles == objectfiles then
+ depfiles = table.copy(objectfiles)
+ end
table.insert(depfiles, dep:targetfile())
end
end
diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua
index b6c4f254d..0b34f68ea 100644
--- a/xmake/actions/build/kinds/static.lua
+++ b/xmake/actions/build/kinds/static.lua
@@ -36,21 +36,19 @@ function _do_link_target(target, opt)
-- get link flags
local linkflags = linkinst:linkflags({target = target})
- -- expand object files with *.o/obj
- local objectfiles = {}
- for _, objectfile in ipairs(target:objectfiles()) do
- if objectfile:find("*", 1, true) then
- local matchfiles = os.match(objectfile)
- if matchfiles then
- table.join2(objectfiles, matchfiles)
+ -- get object files
+ local objectfiles = target:objectfiles()
+
+ -- need build this target?
+ local depfiles = objectfiles
+ for _, dep in ipairs(target:orderdeps()) do
+ if dep:targetkind() == "static" then
+ if depfiles == objectfiles then
+ depfiles = table.copy(objectfiles)
end
- else
- table.insert(objectfiles, objectfile)
+ table.insert(depfiles, dep:targetfile())
end
end
-
- -- need build this target?
- local depfiles = target:objectfiles()
local depvalues = {linkinst:program(), linkflags}
depend.on_changed(function ()