class PaperHouse::ExecutableTask

Compiles *.c files into an executable file.

Attributes

executable_name[W]

@!attribute executable_name

Name of target executable file.

Public Class Methods

new(name, &block) click to toggle source

Defines a rake task called name that builds an executable. Several task attributes can be set in the block.

@yield [task] @example

PaperHouse::ExecutableTask.new :hello do |task|
  task.executable_name = 'hello'
  task.target_directory = 'objects'
  task.sources = 'sources/*.c'
  task.includes = 'includes'
  task.cflags = %w(-Wall -Wextra)
end
Calls superclass method PaperHouse::BuildTask::new
# File lib/paper_house/executable_task.rb, line 27
def initialize(name, &block)
  super name, &block
  Rake::Task[name].prerequisites.each do |each|
    find_prerequisites each, [StaticLibraryTask, SharedLibraryTask]
  end
end

Public Instance Methods

executable_name() click to toggle source
# File lib/paper_house/executable_task.rb, line 38
def executable_name
  (@executable_name ||= @name).to_s
end
Also aliased as: target_file_name
target_file_name()
Alias for: executable_name

Private Instance Methods

cc_options() click to toggle source
# File lib/paper_house/executable_task.rb, line 45
def cc_options
  [o_option, objects, ldflags, l_options].flatten
end
o_option() click to toggle source
# File lib/paper_house/executable_task.rb, line 49
def o_option
  "-o #{target_path}"
end