summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/make
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-05 12:14:16 +0800
committerGitHub <[email protected]>2023-07-05 12:14:16 +0800
commit71e2f7e69838b2c9faedbae8f877c2946bb85e15 (patch)
tree302105da1de4cfe49612a7c0cf037ea18f179446 /xmake/plugins/project/make
parent9810f027c7fd8547d612d8cb8b0182dedfe87b5b (diff)
parent98d0a6b13ee8294b940c3eb6586c58a188b63b0b (diff)
Merge pull request #3924 from xmake-io/makefile
Improve makefile generator to support symlink
Diffstat (limited to 'xmake/plugins/project/make')
-rw-r--r--xmake/plugins/project/make/makefile.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/plugins/project/make/makefile.lua b/xmake/plugins/project/make/makefile.lua
index f43e75f2d..cae9806f0 100644
--- a/xmake/plugins/project/make/makefile.lua
+++ b/xmake/plugins/project/make/makefile.lua
@@ -186,6 +186,19 @@ function _get_cmd_mv(sourcefile, targetfile)
end
end
+-- get command: ln
+function _get_cmd_ln(sourcefile, targetfile)
+ if is_subhost("windows") then
+ if os.isdir(sourcefile) then
+ return string.format("@mklink /D %s %s > NUL 2>&1", sourcefile, targetfile)
+ else
+ return string.format("@mklink %s %s > NUL 2>&1", sourcefile, targetfile)
+ end
+ else
+ return string.format("@ln -s %s %s", sourcefile, targetfile)
+ end
+end
+
-- get command: cpdir
function _get_cmd_cpdir(sourcedir, targetdir)
if is_subhost("windows") then
@@ -240,6 +253,8 @@ function _get_command_string(cmd, outputdir)
return _get_cmd_rm(_get_relative_unix_path(cmd.filepath, outputdir))
elseif kind == "mv" then
return _get_cmd_mv(_get_relative_unix_path(cmd.srcpath, outputdir), _get_relative_unix_path(cmd.dstpath, outputdir))
+ elseif kind == "ln" then
+ return _get_cmd_ln(_get_relative_unix_path(cmd.srcpath, outputdir), _get_relative_unix_path(cmd.dstpath, outputdir))
elseif kind == "cd" then
return _get_cmd_cd(_get_relative_unix_path(cmd.dir, outputdir))
elseif kind == "mkdir" then