task/ext.rake in rucy-0.1.0 vs task/ext.rake in rucy-0.1.1
- old
+ new
@@ -8,29 +8,30 @@
outname = "#{name}.#{EXTEXT}"
out = File.join EXTDIR, outname
extconf = File.join dir, "extconf.rb"
makefile = File.join dir, "Makefile"
- depends = File.join dir, "depends"
+ depend = File.join dir, "depend"
cpps = Dir.glob("#{dir}/**/*.cpp")
- task :build => out
+ task :build => makefile do
+ sh %( cd #{dir} && #{MAKE} )
+ end
task :clean do
sh %( cd #{dir} && #{MAKE} clean ) if File.exist? makefile
- sh %( rm -f #{makefile} #{depends} )
+ sh %( rm -f #{makefile} #{depend} )
end
- file out => makefile do
- sh %( cd #{dir} && #{MAKE} )
- end
-
- file makefile => [extconf, "lib:build"] do #, depends] do
+ file makefile => [extconf, depend] do
sh %( cd #{dir} && #{RUBY} #{File.basename extconf} )
end
- file depends => cpps do
- sh %( cd #{dir} && touch #{depends} )
+ file depend => ["lib:build"] + cpps do
+ incdirs = INCDIRS.map{|s| " -I#{s}"}.join
+ srcs = cpps.map{|cpp| File.basename cpp}.join ' '
+ dep = File.basename depend
+ sh %( cd #{dir} && #{CC} -M #{CFLAGS} #{incdirs} #{srcs} > #{dep} )
end
end# :ext