-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
executable file
·50 lines (37 loc) · 1.44 KB
/
Rakefile
File metadata and controls
executable file
·50 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Emanuel Carnevale 2008
#
require 'rake'
require 'rake/clean'
require 'fileutils'
include FileUtils
#wine /home/emanuel/.wine/drive_c/mcc18/bin/mcc18 -p=18F2520 "onewheel.c" -fo="onewheel.o"
#wine /home/emanuel/.wine/drive_c/mcc18/bin/mplink.exe 18f2520.lkr onewheel.o /o onewheel.out /l"/home/emanuel/.wine/drive_c/mcc18\lib"
CLEAN.include ["dist/", "*.o", "*.cof", "*.err", "*.map", "*.hex", "*.mcp", "*.mcs", "*.mcw", "*.cod", "*.out", "*.lst"]
case PLATFORM when /win32/
MCC_BIN = ""
MCC_LIB = "C:\\MCC18\\lib"
else
MCC_BIN = "wine /home/emanuel/.wine/drive_c/mcc18/bin/"
MCC_LIB = "/home/emanuel/.wine/drive_c/mcc18/bin/lib/"
end
COMPILER = "mcc18.exe"
LINKER = "mplink.exe"
PIC="18F2520"
desc 'Unsurprisingly, compile task compiles the .c files into objects'
task :compile do
FileList["*.c"].each { |c_file|
sh "#{MCC_BIN}#{COMPILER} -p=#{PIC} #{c_file} -fo=#{File.basename(c_file,'.c')+'.o'} -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-"
}
end
desc 'builds the gyro_test version'
file 'gyro_test.hex' => FileList["*.o"] do |t|
link t.name, t.prerequisites
end
desc 'links all the objects files into a hex file'
task :link => [:compile, 'gyro_test.hex']
def link(outfile, o_files)
sh "#{MCC_BIN}#{LINKER} -p=#{PIC}.lkr #{o_files} /o #{outfile} /l\"#{MCC_LIB}\""
end
#rule '.o' => ['.c'] do |t|
# puts "#{compiler} -p=#{pic} #{t.source} -fo=#{t.name} -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-"
#end