-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
40 lines (30 loc) · 712 Bytes
/
Rakefile
File metadata and controls
40 lines (30 loc) · 712 Bytes
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
require 'rake/clean'
require 'pathname'
CC = "clang"
OPT = "-O2 -Wall -Wextra -m64 -g"
CFLAGS = ENV['CFLAGS']
INCLUDE = "src"
directory "bin"
directory "benchmark"
CLEAN.include('src/*.o')
CLOBBER.include('bin/*')
desc 'all setup'
task :default => [:construct, :main] do
end
SRC = FileList["src/*.c"]
OBJ = SRC.ext('o')
desc 'main'
task :main => OBJ do |t|
sh "#{CC} #{t.prerequisites.join ' '} -o bin/#{t.name} #{OPT} #{CFLAGS} -I#{INCLUDE}"
end
desc 'dir setup'
task :construct => [:bin] do
end
rule '.o' => '.c' do |t|
sh "#{CC} -c #{t.source} -o #{t.name} #{OPT} #{CFLAGS} -I#{INCLUDE}"
end
desc 'clang-format'
task :fmt do
sh "clang-format -i src/*.[ch]"
sh "clang-format -i ext/rope/*.c"
end