class Mkduino::ArduinoLibrary

Represents the files needed for a particular arduino library

Public Class Methods

new(name) click to toggle source
# File lib/mkduino.rb, line 51
def initialize name
  @library_sources = []
  @name = name
  @library_includes = []
end

Public Instance Methods

add_include_path(file) click to toggle source
# File lib/mkduino.rb, line 66
def add_include_path file
  pn = Pathname.new(file)
  puts "!! ******** File #{file} not found ******** " unless pn.exist?
  include_dir = pn.file? ? pn.dirname : file

  @library_includes << include_dir.to_s unless @library_includes.include? include_dir.to_s
end
add_source_file(file) click to toggle source
# File lib/mkduino.rb, line 61
def add_source_file(file)
  pn = Pathname.new(file)
  puts "!! ******** File #{file} not found ******** " unless pn.exist?
  @library_sources << file
end
library_name() click to toggle source
# File lib/mkduino.rb, line 78
def library_name
  "lib#{self.name}.a"
end
linker_name() click to toggle source
# File lib/mkduino.rb, line 74
def linker_name
  self.name
end
makefile_am_output() click to toggle source
# File lib/mkduino.rb, line 82
    def makefile_am_output
      output = <<LIBRARY_OUTPUT
lib#{self.name}_a_CFLAGS=-Wall -I$(ARDUINO_VARIANTS) $(ARDUINO_COMMON_INCLUDES) $(lib#{self.name}_a_INCLUDES) -Wl,--gc-sections -fno-caller-saves -ffunction-sections -fdata-sections -mmcu=$(MCU) $(F_CPU) $(ARDUINO_VERSION) -D__AVR_LIBC_DEPRECATED_ENABLE__
lib#{self.name}_a_CXXFLAGS=-Wall -I$(ARDUINO_VARIANTS) $(ARDUINO_COMMON_INCLUDES) $(lib#{self.name}_a_INCLUDES) -Wl,--gc-sections -ffunction-sections -fdata-sections -mmcu=$(MCU) $(F_CPU) $(ARDUINO_VERSION) -D__AVR_LIBC_DEPRECATED_ENABLE__
lib#{self.name}_a_SOURCES = #{@library_sources.join("\\\n                    ")}
lib#{self.name}_a_INCLUDES = -I#{@library_includes.join("\\\n                    -I")}
LIBRARY_OUTPUT
      output
    end
name() click to toggle source
# File lib/mkduino.rb, line 57
def name
  return @name.downcase
end