Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

84 lines (67 sloc) 1.804 kb
# -*- mode: ruby -*-
task :default => :test
require 'rubygems'
require 'rake/testtask'
require 'rubygems/package_task'
FILES = FileList['README', 'ChangeLog', '{lib,ext,doc,test}/**/*', 'ext/yylex.c', 'lib/cast/c.tab.rb']
# cast_ext
file 'ext/cast/cast_ext.so' =>
FileList['ext/cast/*.c', 'ext/cast/yylex.c'] do |t|
cd 'ext/cast' do
ruby 'extconf.rb'
sh 'make'
end
end
# lexer
file 'ext/cast/yylex.c' => 'ext/cast/yylex.re' do |t|
sh "re2c #{t.prerequisites[0]} > #{t.name}"
end
# parser
file 'lib/cast/c.tab.rb' => 'lib/cast/c.y' do |t|
sh "racc #{t.prerequisites[0]}"
end
desc "Build."
task :lib =>
FileList['lib/cast/*.rb',
'lib/cast/c.tab.rb',
'ext/cast/cast_ext.so']
desc "Run unit tests."
Rake::TestTask.new(:test => :lib) do |t|
t.libs << 'ext' << 'test'
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end
desc "Run irb with cast loaded."
task :irb => :lib do
sh 'irb -Ilib:ext -rcast'
end
spec = Gem::Specification.new do |s|
s.name = 'cast'
s.summary = "C parser and AST constructor."
s.version = '0.1.0'
s.author = 'George Ogata'
s.email = 'george.ogata@gmail.com'
s.homepage = 'http://cast.rubyforge.org'
s.rubyforge_project = 'cast'
s.platform = Gem::Platform::RUBY
s.extensions << 'ext/extconf.rb'
s.files = FILES.to_a
s.autorequire = 'cast'
s.test_file = 'test/run.rb'
s.has_rdoc = false
s.add_development_dependency 'racc'
s.requirements << 're2c'
end
Gem::PackageTask.new spec
desc "Remove temporary files in build process"
task :clean do
rm_f 'ext/cast/*.o'
end
desc "Remove all files built from initial source files"
task :clobber => [:clean] do
rm_f 'ext/cast/Makefile'
rm_f 'ext/cast/cast_ext.so'
rm_f 'ext/cast/yylex.c'
rm_f 'lib/cast/c.tab.rb'
rm_f 'pkg'
end
Jump to Line
Something went wrong with that request. Please try again.