Sha256: a2a40491dcebb965eca8306d14a6c1db982bced65083493b0c35ca537abc8bc3

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

# Author::    Marco Tessari  <marco.tessari@epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: Compile.rb 567 2005-04-13 08:00:06Z polrop $


module TTK

  module Strategies

    class Compile < Proxy
      include Concrete

      
      def mk_command
        # Build compiling command
        command = ''
        unless @source_dir.nil?
          @source_dir = Pathname.new(@source_dir)
          @source.map! { |file| @source_dir + file }
        end
        command << @compiler << ' ' << @flags
        @include.each do |dir|
	  command << ' -I ' << dir
	end
        command << ' ' << @source.join(' ')
        command << ' -o ' << @bin
      end

      def prologue 
        super
        test = create(self, Cmd)
        test.name = 'internal command'
        test.exit = 0
        test.fatal = true
        test.command = mk_command

        # Configure output
        test.reject :exit
        test.reject :fatal
      end


      attribute :source,  'source file for the compiler', :mandatory do [] end
      attribute :bin,     'the binary output', :mandatory
      attribute :include, 'include directories' do [] end
      attribute :flags,   'compilation flags',
                '-Wall -W -Werror -ansi -pedantic -O -fomit-frame-pointer'
      attribute :compiler,   'the compiler command', 'gcc'
      attribute :source_dir, 'the source directory, prefix all source file'

    end # class Compile

  end # module Strategies

end # module TTK

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/Compile.rb
ttk-0.1.580 lib/ttk/strategies/Compile.rb
ttk-0.2.1 lib/ttk/strategies/Compile.rb
ttk-0.1.579 lib/ttk/strategies/Compile.rb
ttk-0.2.0 lib/ttk/strategies/Compile.rb