Removed RCS-style IDs.
[ruby-esmart.git] / Rakefile
1 require "library"
2 require "rake/clean"
3 require "rake/testtask"
4 require "rake/rdoctask"
5 require "rake/packagetask"
6 require "rake/contrib/compositepublisher"
7 require "rake/contrib/sshpublisher"
8
9 CLOBBER.include("src/**/*.{s,}o")
10
11 ext_libs = ["container", "draggies", "trans_x11", "file_dialog"].map do |lib|
12         lib = "esmart_" + lib
13         Library.new(lib, ENV["ESMART_PREFIX"] || "/usr/local", "src/#{lib}")
14 end
15
16 l = Library.new("esmart", ENV["ESMART_PREFIX"] || "/usr/local", "src", nil)
17 ext_libs.unshift(l)
18
19 task :default => ext_libs.map { |l| l.so }
20
21 ext_libs.each do |lib|
22         file lib.so => lib.objects do |t|
23                 sh "cc #{lib.ldflags}  #{t.prerequisites.join(" ")} -o #{t.name}"
24         end
25
26         lib.objects.each do |object|
27                 file object => object.sub(/\.[^.]+$/, ".c") do |t|
28                         sh "cc #{lib.cflags} #{t.prerequisites.first} " +
29                            "-c -o #{t.name}"
30                 end
31         end
32 end
33
34 task :install => ext_libs.map { |l| l.so } do |t|
35         destdir = "#{ENV["DESTDIR"]}"
36         sitearchdir = ENV["RUBYARCHDIR"] || Config::CONFIG['sitearchdir']
37
38         FileUtils::Verbose.install(t.prerequisites.to_a, destdir + sitearchdir,
39                                    :mode => 0755)
40 end