require "library" require "rake/clean" require "rake/testtask" require "rake/rdoctask" require "rake/packagetask" require "rake/contrib/compositepublisher" require "rake/contrib/sshpublisher" CLOBBER.include("src/**/*.{s,}o") ext_libs = ["container", "draggies", "trans_x11", "file_dialog"].map do |lib| lib = "esmart_" + lib Library.new(lib, ENV["ESMART_PREFIX"] || "/usr/local", "src/#{lib}") end l = Library.new("esmart", ENV["ESMART_PREFIX"] || "/usr/local", "src", nil) ext_libs.unshift(l) task :default => ext_libs.map { |l| l.so } ext_libs.each do |lib| file lib.so => lib.objects do |t| sh "cc #{lib.ldflags} #{t.prerequisites.join(" ")} -o #{t.name}" end lib.objects.each do |object| file object => object.sub(/\.[^.]+$/, ".c") do |t| sh "cc #{lib.cflags} #{t.prerequisites.first} " + "-c -o #{t.name}" end end end task :install => ext_libs.map { |l| l.so } do |t| destdir = "#{ENV["DESTDIR"]}" sitearchdir = ENV["RUBYARCHDIR"] || Config::CONFIG['sitearchdir'] FileUtils::Verbose.install(t.prerequisites.to_a, destdir + sitearchdir, :mode => 0755) end Rake::RDocTask.new do |t| t.rdoc_dir = "doc" t.title = "ruby-esmart -- Ruby bindings for Esmart" t.options = ["--line-numbers", "--inline-source", "--main", "README"] t.rdoc_files = FileList[ "AUTHORS", "COPYING", "README", "src/rb_esmart.c", "src/esmart_container/rb_esmart_container.c", "src/esmart_draggies/rb_esmart_draggies.c", "src/esmart_file_dialog/rb_esmart_file_dialog.c", "src/esmart_trans_x11/rb_esmart_trans_x11.c" ] end