-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrakefile.rb
More file actions
49 lines (38 loc) · 1.14 KB
/
rakefile.rb
File metadata and controls
49 lines (38 loc) · 1.14 KB
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
task :default => [:run_tests]
include_files = FileList['include/*.h']
src_files = FileList['src/*.c']
test_files = FileList['test/*.c']
def obj_file(src_file)
"obj/" + File.basename(src_file).sub(/\.c/, ".o")
end
(src_files + test_files).each do |file|
obj = obj_file(file)
file obj => [file] + include_files do
sh "gcc -rdynamic -ggdb3 -I include/ -ldl -c #{file} -o #{obj}"
end
end
obj_files = (src_files + test_files).collect{|f| obj_file(f)}
file "tests" => obj_files do
obj = (obj_files - ['obj/main.o', 'obj/alisp.o']).join(" ")
sh "gcc -rdynamic -ggdb3 -lcheck -ldl #{obj} -o tests"
end
file "main" => obj_files do
obj = (obj_files - ['obj/tests.o', 'obj/alisp.o']).join(" ")
sh "gcc -rdynamic -ggdb3 -lcheck -ldl #{obj} -o main"
end
file "alisp" => obj_files do
obj = (obj_files - ['obj/tests.o', 'obj/main.o']).join(" ")
sh "gcc -rdynamic -ggdb3 -lcheck -ldl #{obj} -o alisp"
end
task :run_tests => ["tests"] do
system('./tests')
end
task :run_main => ["main"] do
system('./main')
end
task :run_repl => ["alisp"] do
system('./alisp -i')
end
task :clean => [] do
system('rm obj/*.o *.o')
end