Class: Rscons::Builders::Disassemble

Inherits:
Rscons::Builder show all
Defined in:
lib/rscons/builders/disassemble.rb

Overview

The Disassemble builder produces a disassembly listing of a source file.

Instance Method Summary collapse

Methods inherited from Rscons::Builder

#create_build_target, #features, #name, #produces?, #setup, #standard_build, #standard_finalize, #standard_threaded_build

Instance Method Details

#default_variables(env) ⇒ Hash

Return default construction variables for the builder.

Parameters:

  • env (Environment)

    The Environment using the builder.

Returns:

  • (Hash)

    Default construction variables for the builder.


11
12
13
14
15
16
17
# File 'lib/rscons/builders/disassemble.rb', line 11

def default_variables(env)
  {
    "OBJDUMP" => "objdump",
    "DISASM_CMD" => ["${OBJDUMP}", "${DISASM_FLAGS}", "${_SOURCES}"],
    "DISASM_FLAGS" => ["--disassemble", "--source"],
  }
end

#finalize(options) ⇒ String?

Finalize a build.

Parameters:

  • options (Hash)

    Finalize options.

Returns:

  • (String, nil)

    The target name on success or nil on failure.


50
51
52
# File 'lib/rscons/builders/disassemble.rb', line 50

def finalize(options)
  standard_finalize(options)
end

#run(target, sources, cache, env, vars) ⇒ String, false

Run the builder to produce a build target.

Parameters:

  • target (String)

    Target file name.

  • sources (Array<String>)

    Source file name(s).

  • cache (Cache)

    The Cache object.

  • env (Environment)

    The Environment executing the builder.

  • vars (Hash, VarSet)

    Extra construction variables.

Returns:

  • (String, false)

    Name of the target file on success or false on failure.


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rscons/builders/disassemble.rb', line 29

def run(target, sources, cache, env, vars)
  vars = vars.merge("_SOURCES" => sources)
  command = env.build_command("${DISASM_CMD}", vars)
  if cache.up_to_date?(target, command, sources, env)
    target
  else
    cache.mkdir_p(File.dirname(target))
    ThreadedCommand.new(
      command,
      short_description: "Disassemble #{target}",
      system_options: {out: target})
  end
end