-# $Id: Rakefile 32 2005-04-19 09:07:57Z tilman $
+# $Id: Rakefile 41 2005-05-19 19:18:21Z tilman $
require "rbconfig"
require "rake/clean"
CLOBBER.include(ext_obj, ext_lib, "test/*.eet")
-archdir = Config::CONFIG["archdir"]
-sitearchdir = Config::CONFIG["sitearchdir"]
-libdir = Config::CONFIG["libdir"]
-sitelibdir = Config::CONFIG["sitelibdir"]
-rubylib = Config::CONFIG["LIBRUBYARG_SHARED"]
-destdir = "#{ENV["DESTDIR"]}"
-eet_cflags = `eet-config --cflags`.strip
-eet_libs = `eet-config --libs`.strip
-cflags = "#{ENV["CFLAGS"]} #{eet_cflags}"
-ldflags = "#{ENV["LDFLAGS"]} #{eet_libs}"
-
task :default => [ext_lib]
rule ".o" => [".c"] do |t|
- sh "cc #{cflags} -fPIC -I #{archdir} #{t.source} -c -o #{t.name}"
+ archdir = Config::CONFIG["archdir"]
+ cflags = "#{ENV["CFLAGS"]} #{`eet-config --cflags`.strip} " +
+ "-I#{archdir}"
+
+ sh "cc #{cflags} -fPIC #{t.source} -c -o #{t.name}"
end
file ext_lib => ext_obj do |t|
- sh "cc #{ldflags} -shared -Wl -L #{libdir} #{rubylib} " +
- "#{t.prerequisites.join(" ")} -o #{t.name}"
+ libdir = Config::CONFIG["libdir"]
+ rubylib = Config::CONFIG["LIBRUBYARG_SHARED"]
+ ldflags = "#{ENV["LDFLAGS"]} #{`eet-config --libs`.strip} " +
+ "-L#{libdir} #{rubylib}"
+
+ sh "cc #{ldflags} -shared -Wl #{t.prerequisites.join(" ")} " +
+ "-o #{t.name}"
end
task :install => [ext_lib] do |t|
- FileUtils::Verbose.install(ext_lib, destdir + sitearchdir,
- :mode => 0755)
- FileUtils::Verbose.install("lib/eet.rb", destdir + sitelibdir,
- :mode => 0644)
+ destdir = ENV["DESTDIR"] || ""
+
+ ddir = destdir + Config::CONFIG["sitearchdir"]
+ FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
+ FileUtils::Verbose.install(ext_lib, ddir, :mode => 0755)
+
+ ddir = destdir + Config::CONFIG["sitelibdir"]
+ FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
+ FileUtils::Verbose.install("lib/eet.rb", ddir, :mode => 0644)
end
task :test => [ext_lib]