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