[go: up one dir, main page]

Menu

[r77]: / tags / rdcl-0.2 / Rakefile  Maximize  Restore  History

Download this file

127 lines (110 with data), 2.9 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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
require "rbconfig"
require "platform/platform.rb"
require "rake/packagetask.rb"
require "rdoc/rdoc"
require "VERSION.rb"
BIN_DIR = "/usr/local/bin/"
BIN_DIR_WIN = "c:\\winnt\\system32\\"
INST_DIRS = [
"apps",
"communication",
"link",
"nsof",
"platform",
"utils"
]
PCKG_DIRS = [
"apps",
"communication",
"link",
"nsof",
"platform",
"utils",
"test"
]
PCKG_FILES = [
"COPYRIGHT",
"README",
"VERSION.rb",
"Rakefile"
]
DOC_FILES = [
"apps",
"communication",
"link",
"nsof",
"platform",
"utils",
"README"
]
Rake::PackageTask.new("rdcl", RDCL_VERSION) do |p|
p.need_zip = true
PCKG_DIRS.each {|d| p.package_files.include(d + "/**/*")}
PCKG_FILES.each {|f| p.package_files.include(f)}
end
task :compile_serial_support => ["utils/posix_serial_support/extconf.rb", "utils/posix_serial_support/posix_serial_support.c"] do
p = Dir.pwd
Dir.chdir("utils/posix_serial_support/")
ruby "extconf.rb"
sh "make"
Dir.chdir(p)
end
task :clean_serial_support => ["utils/posix_serial_support/extconf.rb", "utils/posix_serial_support/posix_serial_support.c"] do
p = Dir.pwd
Dir.chdir("utils/posix_serial_support/")
ruby "extconf.rb"
sh "make clean"
FileUtils.rm("Makefile")
Dir.chdir(p)
end
task :install_serial_support => ["utils/posix_serial_support/extconf.rb", "utils/posix_serial_support/posix_serial_support.c"] do
p = Dir.pwd
Dir.chdir("utils/posix_serial_support/")
sh "make install"
Dir.chdir(p)
end
task :compile do
if Platform::isPosix?
if RUBY_VERSION =~ /1.9/
Rake::Task["compile_serial_support"].invoke
else
puts "Ruby 1.9 required."
exit 1
end
end
end
task :clean do
if Platform::isPosix?
Rake::Task["clean_serial_support"].invoke
end
end
task :install do
if Platform::isPosix? and not RUBY_VERSION =~ /1.9/
puts "Ruby 1.9 required."
exit 1
end
dest = Config::CONFIG["rubylibdir"] + "/rdcl/"
FileUtils.remove_dir(dest, :force => true)
FileUtils.mkdir(dest, :mode => 0755 )
dirs = Array(INST_DIRS)
files = ["VERSION.rb"]
INST_DIRS.each do |dir|
Dir[dir + "/**/*"].each do |src|
if File.directory?(src) then dirs << src else files << src end
end
end
dirs.each { |dir| FileUtils.mkdir_p(dest + dir, :mode => 0755) if not File.exist?(dest + dir) }
files.each { |file| FileUtils.install(file, File.dirname(dest + file), :mode => 0644) }
if Platform::isPosix?
Rake::Task["install_serial_support"].invoke
FileUtils.install("apps/nwt/nwt", BIN_DIR, :mode => 0755)
elsif Platform::isWindows?
FileUtils.install("apps/nwt/nwt.bat", BIN_DIR_WIN)
end
end
task :doc do
readme = File.open("README") { |f| f.read.gsub(/VERSION .*/, "VERSION " + RDCL_VERSION) }
File.open("README", "w") { |f| f.write(readme) }
RDoc::RDoc.new.document(DOC_FILES)
end
task :default => [:compile]