Sha256: 4a55b24a09a25c2c43f245c1d525e48e59e4540a195cbbb8e3746330eaf8e519

Contents?: true

Size: 1.75 KB

Versions: 12

Compression:

Stored size: 1.75 KB

Contents

module Rscons
  module Builders
    # The Disassemble builder produces a disassembly listing of a source file.
    class Disassemble < Builder

      # Return default construction variables for the builder.
      #
      # @param env [Environment] The Environment using the builder.
      #
      # @return [Hash] Default construction variables for the builder.
      def default_variables(env)
        {
          "OBJDUMP" => "objdump",
          "DISASM_CMD" => ["${OBJDUMP}", "${DISASM_FLAGS}", "${_SOURCES}"],
          "DISASM_FLAGS" => ["--disassemble", "--source"],
        }
      end

      # Run the builder to produce a build target.
      #
      # @param target [String] Target file name.
      # @param sources [Array<String>] Source file name(s).
      # @param cache [Cache] The Cache object.
      # @param env [Environment] The Environment executing the builder.
      # @param vars [Hash,VarSet] Extra construction variables.
      #
      # @return [String,false]
      #   Name of the target file on success or false on failure.
      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

      # Finalize a build.
      #
      # @param options [Hash]
      #   Finalize options.
      #
      # @return [String, nil]
      #   The target name on success or nil on failure.
      def finalize(options)
        standard_finalize(options)
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rscons-1.19.1 lib/rscons/builders/disassemble.rb
rscons-1.19.0 lib/rscons/builders/disassemble.rb
rscons-1.18.0 lib/rscons/builders/disassemble.rb
rscons-1.17.0 lib/rscons/builders/disassemble.rb
rscons-1.16.0 lib/rscons/builders/disassemble.rb
rscons-1.15.0 lib/rscons/builders/disassemble.rb
rscons-1.14.0 lib/rscons/builders/disassemble.rb
rscons-1.13.0 lib/rscons/builders/disassemble.rb
rscons-1.12.0 lib/rscons/builders/disassemble.rb
rscons-1.11.1 lib/rscons/builders/disassemble.rb
rscons-1.11.0 lib/rscons/builders/disassemble.rb
rscons-1.10.0 lib/rscons/builders/disassemble.rb