Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2013-05-15 17:30:45 +0400
committerJason Perkins <starkos@industriousone.com>2013-05-15 17:30:45 +0400
commitcfa62ad56f92a25659810220238d4a0bf0edfd67 (patch)
treedb2208070c000646d145540a026b1a259dc30dec /src
parentecbe7801d3a6ad36ec986f1ed16d8cb2ad306143 (diff)
Fixed bug #176: Target prefix breaks GCC linking
Diffstat (limited to 'src')
-rw-r--r--src/actions/make/make_cpp.lua2
-rw-r--r--src/tools/gcc.lua26
-rw-r--r--src/tools/snc.lua13
3 files changed, 12 insertions, 29 deletions
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index 8f34455..99387ad 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -262,8 +262,8 @@
-- Patch #3401184 changed the order
_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))
- _p(' LIBS +=%s', make.list(cc.getlinkflags(cfg)))
_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath"))))
+ _p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))
if cfg.kind == "StaticLib" then
if cfg.platform:startswith("Universal") then
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua
index 6fcc88c..403f532 100644
--- a/src/tools/gcc.lua
+++ b/src/tools/gcc.lua
@@ -186,31 +186,13 @@
--
--- Returns a list of linker flags for library search directories and library
--- names. See bug #1729227 for background on why the path must be split.
+-- This is poorly named: returns a list of linker flags for external
+-- (i.e. system, or non-sibling) libraries. See bug #1729227 for
+-- background on why the path must be split.
--
function premake.gcc.getlinkflags(cfg)
- local result = { }
-
- for _, value in ipairs(premake.getlinks(cfg, "siblings", "object")) do
- if (value.kind == "StaticLib") then
- -- don't use "-lname" when linking static libraries
- -- instead use path/Name.ext so as not to link with a SharedLib of the same name
- -- if one is present.
- local pathstyle = premake.getpathstyle(value)
- local namestyle = premake.getnamestyle(value)
- local linktarget = premake.gettarget(value, "link", pathstyle, namestyle, cfg.system)
- local rebasedpath = path.rebase(linktarget.fullpath, value.location, cfg.location)
- table.insert(result, rebasedpath)
- else
- --premake does not support creating frameworks so this is just a SharedLib link
- --link using -lname
- table.insert(result, '-l' .. _MAKE.esc(value.linktarget.basename))
- end
- end
-
- -- "-llib" is fine for system dependencies
+ local result = {}
for _, value in ipairs(premake.getlinks(cfg, "system", "name")) do
if path.getextension(value) == ".framework" then
table.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value)))
diff --git a/src/tools/snc.lua b/src/tools/snc.lua
index c4c7d42..e829d68 100644
--- a/src/tools/snc.lua
+++ b/src/tools/snc.lua
@@ -123,14 +123,15 @@
---
--- Returns a list of linker flags for library search directories and library
--- names. See bug #1729227 for background on why the path must be split.
---
+ --
+ -- This is poorly named: returns a list of linker flags for external
+ -- (i.e. system, or non-sibling) libraries. See bug #1729227 for
+ -- background on why the path must be split.
+ --
function premake.snc.getlinkflags(cfg)
- local result = { }
- for _, value in ipairs(premake.getlinks(cfg, "all", "basename")) do
+ local result = {}
+ for _, value in ipairs(premake.getlinks(cfg, "system", "name")) do
table.insert(result, '-l' .. _MAKE.esc(value))
end
return result