diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua index 76ccbcd9b89..e9607707d64 100644 --- a/xmake/actions/build/kinds/binary.lua +++ b/xmake/actions/build/kinds/binary.lua @@ -54,7 +54,7 @@ function _do_link_target(target, opt) end end, {dependfile = target:dependfile(), lastmtime = os.mtime(target:targetfile()), - changed = target:is_rebuilt(), + changed = target:is_rebuilt() or option.get("linkonly"), values = depvalues, files = depfiles, dryrun = dryrun}) end diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua index 67671b7ef92..9b65381e6d2 100644 --- a/xmake/actions/build/kinds/shared.lua +++ b/xmake/actions/build/kinds/shared.lua @@ -55,7 +55,7 @@ function _do_link_target(target, opt) end, {dependfile = target:dependfile(), lastmtime = os.mtime(target:targetfile()), - changed = target:is_rebuilt(), + changed = target:is_rebuilt() or option.get("linkonly"), values = depvalues, files = depfiles, dryrun = dryrun}) end diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua index 11f9c7f6a62..6b28eb4e115 100644 --- a/xmake/actions/build/kinds/static.lua +++ b/xmake/actions/build/kinds/static.lua @@ -55,7 +55,7 @@ function _do_link_target(target, opt) end, {dependfile = target:dependfile(), lastmtime = os.mtime(target:targetfile()), - changed = target:is_rebuilt(), + changed = target:is_rebuilt() or option.get("linkonly"), values = depvalues, files = depfiles, dryrun = dryrun}) end diff --git a/xmake/actions/build/xmake.lua b/xmake/actions/build/xmake.lua index 8cdbb953bf2..9cdacdbea57 100644 --- a/xmake/actions/build/xmake.lua +++ b/xmake/actions/build/xmake.lua @@ -32,7 +32,7 @@ task("build") , {'r', "rebuild", "k", nil , "Rebuild the target." } , {'a', "all", "k", nil , "Build all targets." } , {nil, "shallow", "k", nil , "Only re-build the given targets without dependencies." } - , {'g', "group", "kv", nil , "Build all targets of the given group. It support path pattern matching.", + , {'g', "group", "kv", nil , "Build all targets of the given group. It support path pattern matching.", "e.g.", " xmake -g test", " xmake -g test_*", @@ -44,6 +44,7 @@ task("build") "Set the number of parallel compilation jobs." } , {nil, "linkjobs", "kv", nil, "Set the number of parallel link jobs." } , {'w', "warning", "k", false , "Enable the warnings output. (deprecated)" } + , {nil, "linkonly", "k", false , "Only link targets if object files have been compiled." } , {nil, "files", "kv", nil , "Build the given source files.", "e.g. ", " - xmake --files=src/main.c",