# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved. # License:: LGPL # $Id: /fey/uttk/trunk/lib/uttk/strategies/Make.rb 8789 2005-09-27T14:49:49.088376Z ertai $ module Uttk module Strategies class Make < Proxy include Concrete def mk_make_cmd @symtbl[:make] || ENV['MAKE'] || 'make' end def mk_cmd ( target, continue_mode, jobs=nil, options='' ) make = mk_make_cmd() unless options.empty? case options when Array options = ' ' + options.join(' ') when String options = " #{options}" end end opts = '' opts += ' -k' if continue_mode opts += " -j#{jobs}" if jobs "#{make} #{target}#{opts}#{options}" end def prologue super cmd = mk_cmd(@target.target, @continue_mode, @jobs, @options) create(Cmd) do |test| test.name = 'internal command' test.exit = 0 test.dir = @dir test.command = cmd test.reject :strategy, :exit, :fatal, :dir # test.reject :status end end class Target include Abstract def target self.class.target end def self.target name.downcase.sub(/^.*:/, '') end end class Default < Target include Concrete def self.target '' end end class All < Target include Concrete end class Check < Target include Concrete end class DistCheck < Target include Concrete end class Install < Target include Concrete end attribute :dir, 'building directory', :mandatory attribute :target, 'select a target', Class, Default, :invisible attribute :continue_mode, 'use the -k option of make', false attribute :jobs, 'number of jobs (-j option)' attribute :options, 'other options' do [] end end # class Make end # module Strategies end # module Uttk