class Daedalus::Program

Public Class Methods

new(path, files) click to toggle source
Calls superclass method Daedalus::Path::new
    # File lib/daedalus.rb
787 def initialize(path, files)
788   super path
789   @files = files.sort_by { |x| x.path }
790 end

Public Instance Methods

build(ctx) click to toggle source
    # File lib/daedalus.rb
828 def build(ctx)
829   ctx.log.inc!
830   ctx.pre_link objects
831   ctx.link @path, objects
832 end
clean() click to toggle source
    # File lib/daedalus.rb
834 def clean
835   @files.each do |f|
836     f.clean if f.respond_to? :clean
837   end
838 
839   File.unlink @path if File.exist?(@path)
840   File.unlink data_path if File.exist?(data_path)
841   Dir.rmdir artifacts_path if Dir.entries(artifacts_path).empty?
842 end
consider(ctx, tasks) click to toggle source
    # File lib/daedalus.rb
823 def consider(ctx, tasks)
824   @files.each { |x| x.consider(ctx, tasks) }
825   tasks.post << self unless tasks.empty? and File.exist?(@path)
826 end
describe(ctx) click to toggle source
    # File lib/daedalus.rb
844 def describe(ctx)
845   puts "Program: #{@path}"
846 
847   @files.each do |f|
848     f.describe(ctx)
849   end
850 end
file_info(ctx, files) click to toggle source
    # File lib/daedalus.rb
852 def file_info(ctx, files)
853   files.each do |n|
854     obj = @files.find { |x| x.path == n }
855     if obj
856       obj.info(ctx)
857     else
858       puts "Unable to find file: #{n}"
859     end
860   end
861 end
objects() click to toggle source
    # File lib/daedalus.rb
792 def objects
793   # This partitions the list into .o's first and .a's last. This
794   # is because gcc on some platforms require that static libraries
795   # be linked last. This is because gcc builds a list of undefined
796   # symbols, and then when it hits a .a, looks in the archive
797   # to try and resolve those symbols. So if a .o needs something
798   # from a .a, the .a MUST come after the .o
799   objects = []
800   archives = []
801 
802   @files.each do |x|
803     if x.respond_to? :object_path
804       if File.extname(x.object_path) == ".a"
805         archives << x.object_path
806       else
807         objects << x.object_path
808       end
809     else
810       x.objects.each do |obj|
811         if File.extname(obj) == ".a"
812           archives << obj
813         else
814           objects << obj
815         end
816       end
817     end
818   end
819 
820   objects.sort + archives
821 end