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.
14 15 16 17 18 |
# File 'lib/mkduino.rb', line 14 def initialize name @library_sources = [] @name = name @library_includes = [] end |
Instance Method Details
#add_include_path(file) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/mkduino.rb', line 29 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
24 25 26 27 28 |
# File 'lib/mkduino.rb', line 24 def add_source_file(file) pn = Pathname.new(file) puts "!! ******** File #{file} not found ******** " unless pn.exist? @library_sources << file end |
#library_name ⇒ Object
41 42 43 |
# File 'lib/mkduino.rb', line 41 def library_name "lib#{self.name}.a" end |
#linker_name ⇒ Object
37 38 39 |
# File 'lib/mkduino.rb', line 37 def linker_name self.name end |
#makefile_am_output ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/mkduino.rb', line 45 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 -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 ⇒ Object
20 21 22 |
# File 'lib/mkduino.rb', line 20 def name return @name.downcase end |