Core and libraries compile
This commit is contained in:
parent
cd62c35719
commit
e17f440333
|
@ -50,7 +50,6 @@ def buildHeaderMap
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
p HEADERMAP
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def parseInoFiles
|
def parseInoFiles
|
||||||
|
@ -116,30 +115,50 @@ buildHeaderMap
|
||||||
parseInoFiles
|
parseInoFiles
|
||||||
|
|
||||||
File.open("#{$BUILD_DIR}/Rakefile", 'w') do |rakeFile|
|
File.open("#{$BUILD_DIR}/Rakefile", 'w') do |rakeFile|
|
||||||
SOURCES = FileList.new(ARGV).select {|f| f =~ /\.(c|cpp|cp|cxx|S)$/}
|
SOURCES = Rake::FileList.new(ARGV).select {|f| f =~ /\.(c|cpp|cp|cxx|S)$/}
|
||||||
INCLUDES= ($CORES+$LIBRARIES).map {|l| " +\n \" -I'#{l}'\""}.join('')
|
INCLUDES= ($CORES+$LIBRARIES).map {|l| " +\n \" -I'#{l}'\""}.join('')
|
||||||
rakeFile.print <<END_RAKE
|
rakeFile.print <<END_RAKE
|
||||||
CC = '/usr/local/CrossPack-AVR/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
CC = '/usr/local/CrossPack-AVR/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=#{BUILD['mcu']} -DF_CPU=#{BUILD['f_cpu']} -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I ../..'#{INCLUDES}
|
||||||
AR = '/usr/local/CrossPack-AVR/bin/avr-ar crsv'
|
AR = '/usr/local/CrossPack-AVR/bin/avr-ar crsv'
|
||||||
LIBRARIES = [#{$LIBRARIES.map{|l| "'"+l+"'"}.join(' ')}]
|
LIBRARIES = [#{$LIBRARIES.map{|l| "'"+l+"'"}.join(' ')}]
|
||||||
|
|
||||||
def compile(dest, *src)
|
def compile(dest, extrainc, *src)
|
||||||
directory dest
|
directory dest
|
||||||
archive = dest.ext('.a')
|
archive = dest.ext('.a')
|
||||||
sources = Rake::FileList.new(src)
|
sources = Rake::FileList.new(src)
|
||||||
objects = sources.pathmap(dest+"/%n.o")
|
objects = sources.pathmap(dest+"/%n.o")
|
||||||
objects.each_index do |i|
|
objects.each_index do |i|
|
||||||
file objects[i] => sources[i] do
|
file objects[i] => [sources[i],dest] do
|
||||||
sh "%s '%s' -o '%s'" % [CC, sources[i], objects[i]]
|
sh "%s %s '%s' -o '%s'" % [CC, extrainc ? "-I '"+extrainc+"'" : '', sources[i], objects[i]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
file archive => objects do
|
file archive => objects do
|
||||||
sh ("%s '%s' " % [AR, archive])+objects.map {|o| "'"+o+"'"}.join(" ")
|
sh ("%s '%s' " % [AR, archive])+objects.map {|o| "'"+o+"'"}.join(" ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
compile('sketch', #{SOURCES.map{|f| "'../../"+f+"'"}.join(', ')})
|
def compile_library(lib)
|
||||||
END_RAKE
|
extrainc = nil
|
||||||
|
utility = lib+"/utility"
|
||||||
|
if File::exists?(utility)
|
||||||
|
extrainc = utility
|
||||||
|
end
|
||||||
|
compile(lib.pathmap('lib/%f'), extrainc, *Rake::FileList[lib+"/*.{c,cpp,cp,cxx,S}", lib+"/utility/*.{c,cpp,cp,cxx,S}"])
|
||||||
|
end
|
||||||
|
|
||||||
|
def compile_core(core,variant)
|
||||||
|
list = Rake::FileList[core+"/*.{c,cpp,cp,cxx,S}"]
|
||||||
|
list.add(variant+"/*.{c,cpp,cp,cxx,S}") if variant
|
||||||
|
compile('core', nil, list)
|
||||||
|
end
|
||||||
|
|
||||||
|
compile('sketch', nil, #{SOURCES.map{|f| "'../../"+f+"'"}.join(', ')})
|
||||||
|
compile_core(#{$CORES.map {|c| "'"+c+"'"}.join(", ")})
|
||||||
|
END_RAKE
|
||||||
|
|
||||||
|
$LIBRARIES.each do |lib|
|
||||||
|
rakeFile.puts "compile_library('#{lib}')"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user