Sha256: 99cee4d2566557bca696d6ae110bad938b525ab549effe4ed29f2c8f795045be

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

# Author::    Marco Tessari  <marco.tessari@epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Compile.rb 22112 2006-02-22T08:30:11.236459Z pouillar  $


module Uttk

  module Strategies

    # I'm not maintained that much since the _Package_ strategy do a better
    # job than I. Can be useful if you have only few files to compile and do
    # not have a Makefile.
    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 Uttk

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uttk-0.3.1.2 lib/uttk/strategies/Compile.rb
uttk-0.3.6.1 lib/uttk/strategies/Compile.rb
uttk-0.3.5.0 lib/uttk/strategies/Compile.rb
uttk-0.4.6.1 lib/uttk/strategies/Compile.rb
uttk-0.4.5.0 lib/uttk/strategies/Compile.rb
uttk-0.4.6.2 lib/uttk/strategies/Compile.rb