diff options
| author | ruki <[email protected]> | 2023-07-04 23:55:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-07-04 23:55:42 +0800 |
| commit | 98d0a6b13ee8294b940c3eb6586c58a188b63b0b (patch) | |
| tree | 302105da1de4cfe49612a7c0cf037ea18f179446 /xmake/plugins/project/make/makefile.lua | |
| parent | 9810f027c7fd8547d612d8cb8b0182dedfe87b5b (diff) | |
add ln for makefile generator #3921
Diffstat (limited to 'xmake/plugins/project/make/makefile.lua')
| -rw-r--r-- | xmake/plugins/project/make/makefile.lua | 15 |
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 |
