Class: Mkduino::ArduinoLibrary
- Inherits:
-
Object
- Object
- Mkduino::ArduinoLibrary
- Defined in:
- lib/mkduino.rb
Overview
Represents the files needed for a particular arduino library
Instance Method Summary collapse
- #add_include_path(file) ⇒ Object
- #add_source_file(file) ⇒ Object
-
#initialize(name) ⇒ ArduinoLibrary
constructor
A new instance of ArduinoLibrary.
- #library_name ⇒ Object
- #linker_name ⇒ Object
- #makefile_am_output ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(name) ⇒ ArduinoLibrary
Returns a new instance of ArduinoLibrary.
51 52 53 54 55 |
# File 'lib/mkduino.rb', line 51 def initialize name @library_sources = [] @name = name @library_includes = [] end |
Instance Method Details
#add_include_path(file) ⇒ Object
66 67 68 69 70 71 72 |
# 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) ⇒ Object
61 62 63 64 65 |
# 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 ⇒ Object
78 79 80 |
# File 'lib/mkduino.rb', line 78 def library_name "lib#{self.name}.a" end |
#linker_name ⇒ Object
74 75 76 |
# File 'lib/mkduino.rb', line 74 def linker_name self.name end |
#makefile_am_output ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/mkduino.rb', line 82 def makefile_am_output 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__\nlib\#{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__\nlib\#{self.name}_a_SOURCES = \#{@library_sources.join(\"\\\\\\n \")}\nlib\#{self.name}_a_INCLUDES = -I\#{@library_includes.join(\"\\\\\\n -I\")}\n" output end |
#name ⇒ Object
57 58 59 |
# File 'lib/mkduino.rb', line 57 def name return @name.downcase end |