class L::C::TargetCSource

A C source file.

Public Class Methods

new(opt, f, input = []) click to toggle source
# File lib/rub/l/c.rb, line 296
def initialize(opt, f, input = [])
        #TargetC.initialize
        
        @f = C.path(f)
        @opt = opt
        @input = input
        
        register
end

Public Instance Methods

build() click to toggle source
# File lib/rub/l/c.rb, line 355
def build
        @depsbuilt and return

        @depsbuilt = true
        build_dependancies
end
included_files(opt, set=Set.new) click to toggle source
# File lib/rub/l/c.rb, line 306
def included_files(opt, set=Set.new)
        set.include?(@f) and return

        set << @f
        @incs ||= @f.readlines.map do |l|
                l =~ /\s*#\s*include\s*("(.*)"|<(.*)>)/ or next
                if $3 and !D[:l_c_system_headers]
                        next
                end
                
                p  = Pathname.new( $2 || $3 )
                ip = opt.compiler.include_directories(opt)
                
                if $2
                        ip << @f.dirname
                end
                
                h = nil
                ip.each do |d|
                        hg = d.join(p)
                        
                        if hg.exist?
                                h = hg
                                break
                        end
                end
                
                h # Ignoring missing headers for now.
        end.compact
        
        @incs.each do |h|
                icd = R::find_target(h) || TargetCSource.new(opt, h, @input)
                
                if icd.respond_to? :included_files
                        icd.included_files opt, set
                else
                        set << h
                end
        end
end
input() click to toggle source
# File lib/rub/l/c.rb, line 347
def input
        @input + included_files(@opt)
end
output() click to toggle source
# File lib/rub/l/c.rb, line 351
def output
        Set[@f]
end