diff options
author | starkos <none@none> | 2008-11-21 19:49:00 +0300 |
---|---|---|
committer | starkos <none@none> | 2008-11-21 19:49:00 +0300 |
commit | a9404828928d31baa08176274582d022c6f05c31 (patch) | |
tree | 76cd16fd7b5d6bbd933cf069a2a1344e61f0a7ff | |
parent | d90e899be5e8599866741ceaaef2f92c4f2ac462 (diff) |
Fix relative paths to target dependencies
-rw-r--r-- | src/actions/make/_make.lua | 1 | ||||
-rw-r--r-- | src/base/config.lua | 6 | ||||
-rw-r--r-- | src/base/path.lua | 12 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua index e33a871..7588d53 100644 --- a/src/actions/make/_make.lua +++ b/src/actions/make/_make.lua @@ -36,6 +36,7 @@ for _, prj in ipairs(deps) do local prjcfg = premake.getconfig(prj, cfg.name) local target = premake.gettargetfile(prjcfg, "target", prjcfg.kind, iif(prjcfg.kind == "StaticLib", "linux", nil)) + target = path.rebase(target, prjcfg.location, cfg.location) table.insert(result, _MAKE.esc(target)) end return result diff --git a/src/base/config.lua b/src/base/config.lua index c3bcee3..a5492b4 100644 --- a/src/base/config.lua +++ b/src/base/config.lua @@ -170,11 +170,7 @@ target = prjcfg.target end - -- target is currently relative to its project location, make - -- it relative to my location instead - target = path.getabsolute(path.join(prjcfg.location, target)) - target = path.getrelative(cfg.location, target) - + target = path.rebase(target, prjcfg.location, cfg.location) table.insert(libs, target) else if (range ~= "siblings") then diff --git a/src/base/path.lua b/src/base/path.lua index d14dfa2..a08bce7 100644 --- a/src/base/path.lua +++ b/src/base/path.lua @@ -98,6 +98,18 @@ -- +-- Takes a path which is relative to one location and makes it relative +-- to another location instead. +-- + + function path.rebase(p, oldbase, newbase) + p = path.getabsolute(path.join(oldbase, p)) + p = path.getrelative(newbase, p) + return p + end + + +-- -- Returns the relative path from src to dest. -- |