Class: Makefile
- Inherits:
-
Object
- Object
- Makefile
- Defined in:
- lib/rad/generators/makefile/makefile.rb
Class Method Summary collapse
-
.compose_for_sketch(build_dir) ⇒ Object
build the sketch Makefile for the given template based on the values in its software and hardware config files.
- .hardware_params ⇒ Object
- .software_params ⇒ Object
Class Method Details
.compose_for_sketch(build_dir) ⇒ Object
build the sketch Makefile for the given template based on the values in its software and hardware config files
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rad/generators/makefile/makefile.rb', line 8 def compose_for_sketch(build_dir) params = hardware_params.merge software_params params['target'] = build_dir.split("/").last params['libraries_root'] = "#{File.(RAD_ROOT)}/vendor/libraries" params['libraries'] = $load_libraries # load only libraries used # needed along with ugly hack of including another copy of twi.h in wire, when using the Wire.h library params['twi_c'] = $load_libraries.include?("Wire") ? "#{params['arduino_root']}/hardware/libraries/Wire/utility/twi.c" : "" params['asm_files'] = Dir.entries( File.(RAD_ROOT) + "/" + PROJECT_DIR_NAME ).select{|e| e =~ /\.S/} e = ERB.new File.read("#{File.dirname(__FILE__)}/makefile.erb") File.open("#{build_dir}/Makefile", "w") do |f| f << e.result(binding) end end |
.hardware_params ⇒ Object
27 28 29 30 |
# File 'lib/rad/generators/makefile/makefile.rb', line 27 def hardware_params return @hardware_params if @hardware_params return @hardware_params = YAML.load_file( "#{RAD_ROOT}/config/hardware.yml") end |
.software_params ⇒ Object
32 33 34 35 |
# File 'lib/rad/generators/makefile/makefile.rb', line 32 def software_params return @software_params if @software_params return @software_params = YAML.load_file( "#{RAD_ROOT}/config/software.yml" ) end |