Program builder cleanup, track object file source language - #94, #87

This commit is contained in:
josh committed 2019-04-09 19:41:13 -04:00
1 parent a655d04541
commit 3b00016278
8 files changed
+81 -59

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
module Rscons
module Builders
module Mixins
# Mixin providing functionality for a builder that links object files
# together into a program.
module Program
# Run the builder to produce a build target.
def run(options)
if @command
finalize_command(sources: @objects)
else
ld = @env.expand_varref("${#{ld_var}}", @vars)
if ld == ""
@objects.find do |object|
if builder = @env.builder_for(object)
if ld = builder.preferred_ld
true
end
end
end
end
if ld.nil? || ld == ""
ld = default_ld
end
@vars["_TARGET"] = @target
@vars["_SOURCES"] = @objects
@vars["#{ld_var}"] = ld
command = @env.build_command("${#{ld_var}CMD}", @vars)
standard_command("Linking => #{@target}", command, sources: @objects)
end
end
end
end
end
end