forked from shiika-lang/shiika
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
72 lines (58 loc) · 1.58 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require 'bundler/setup'
file 'lib/shiika/parser.ry' => 'lib/shiika/parser.ry.erb' do
sh "erb lib/shiika/parser.ry.erb > lib/shiika/parser.ry"
end
file 'lib/shiika/parser.rb' => 'lib/shiika/parser.ry' do
debug = (ENV["DEBUG"] == "1")
cmd = "racc #{'--verbose --debug' if debug} -o lib/shiika/parser.rb lib/shiika/parser.ry"
sh cmd
end
task :parser => 'lib/shiika/parser.rb'
task :doc do
sh "gitbook build book doc"
end
#require_relative 'lib/shiika/version'
desc "git ci, git tag and git push"
task :release do
sh "git diff HEAD"
v = File.read('CHANGELOG.md')[/v([\d\.]+) /, 1]
puts "release as #{v}? [y/N]"
break unless $stdin.gets.chomp == "y"
sh "git ci -am '#{v}'"
sh "git tag '#{v}'"
sh "git push origin master --tags"
end
task :default => [:parser, :test]
task :run do
sh "cargo run"
sh "llc a.ll"
sh "cc -I/usr/local/Cellar/bdw-gc/7.6.0/include/ -L/usr/local/Cellar/bdw-gc/7.6.0/lib/ -lgc -o a.out a.s"
sh "./a.out"
end
task :opt do
sh "cargo run"
sh "opt -O3 a.ll > a.bc"
sh "llvm-dis a.bc -o a2.ll"
sh "llc a.bc"
sh "cc -I/usr/local/Cellar/bdw-gc/7.6.0/include/ -L/usr/local/Cellar/bdw-gc/7.6.0/lib/ -lgc -o a.out a.s"
sh "./a.out"
end
rule ".rs" => ".rs.erb" do |t|
sh "erb #{t.source} > #{t.name}"
end
LIBS = [
"src/corelib/int.rs",
"src/corelib/float.rs",
]
task :build => LIBS do
sh "cargo build"
end
task :clean do
files = `git status -sz --untracked-files=normal --ignored`.
lines("\0", chomp: true).
filter_map { |l| /\A!! /.match(l)&.post_match }
rm_rf files
end
task :test => LIBS do
sh "cargo test"
end