Fix Makefile linking to object files

This commit is contained in:
Jason Perkins 2013-01-31 09:38:45 -05:00
parent 8bf4499335
commit faba7a72dc
2 changed files with 33 additions and 8 deletions

View File

@ -236,14 +236,14 @@
end end
-- The "-l" flag is fine for system libraries -- The "-l" flag is fine for system libraries
links = config.getlinks(cfg, "system", "name") links = config.getlinks(cfg, "system", "fullpath")
for _, link in ipairs(links) do for _, link in ipairs(links) do
if path.isframework(link) then if path.isframework(link) then
table.insert(result, "-framework " .. path.getbasename(link)) table.insert(result, "-framework " .. path.getbasename(link))
elseif path.isobjectfile(link) then elseif path.isobjectfile(link) then
table.insert(result, link) table.insert(result, link)
else else
table.insert(result, "-l" .. link) table.insert(result, "-l" .. path.getbasename(link))
end end
end end

View File

@ -262,6 +262,31 @@
end end
--
-- If the object file is referenced with a path, it should be
-- made relative to the project.
--
function suite.links_onObjectFileOutsideProject()
location "MyProject"
links { "obj/Debug/generated.o" }
prepare()
test.isequal({ "../obj/Debug/generated.o" }, gcc.getlinks(cfg))
end
--
-- Make sure shell variables are kept intact for object file paths.
--
function suite.links_onObjectFileWithShellVar()
location "MyProject"
links { "$(IntDir)/generated.o" }
prepare()
test.isequal({ "$(IntDir)/generated.o" }, gcc.getlinks(cfg))
end
-- --
-- Include directories should be made project relative. -- Include directories should be made project relative.
-- --