-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
41 lines (34 loc) · 1.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require "bundler/gem_tasks"
require 'rake'
require 'rake/testtask'
require 'rake/clean'
task :default => :test
LIB_EXT = RbConfig::CONFIG['DLEXT']
desc "Run unit tests"
Rake::TestTask.new do |test|
test.libs << "test"
test.test_files = Dir[ "test/**/*_test.rb"]
test.verbose = false
end
# rule to build the extension: this says
# that the extension should be rebuilt
# after any change to the files in ext
file "lib/libsvm/libsvm.#{LIB_EXT}" =>
Dir.glob("ext/libsvm/*{.rb,.c}") do
Dir.chdir("ext/libsvm") do
# this does essentially the same thing
# as what rubygems does
ruby "extconf.rb"
sh "make"
end
cp "ext/libsvm/libsvm.#{LIB_EXT}", "lib/libsvm/libsvm.#{LIB_EXT}"
end
# make the :test task depend on the shared
# object, so it will be built automatically
# before running the tests
task :test => "lib/libsvm/libsvm.#{LIB_EXT}"
# use 'rake clean' and 'rake clobber' to
# easily delete generated files
CLEAN.include("ext/**/*{.o,.log,.#{LIB_EXT}}")
CLEAN.include('ext/**/Makefile')
CLOBBER.include("lib/**/*.#{LIB_EXT}")