-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
42 lines (34 loc) · 1.11 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
# Build file for Starling
# Hasan Veldstra <[email protected]>
CC = (`icu-config --cc` + `icu-config --cflags` +
"-std=c99 -pedantic -Wall").gsub(/\n/, " ")
BLD = "ebin"
PRV = "priv"
SRC = "src"
C_SRC = "c_src"
ERL_FILES = Dir["#{SRC}/*.erl"].join(" ")
DRV_FILES = Dir["#{C_SRC}/*.c"].join(" ")
ICU_INCLUDE_FLAGS = `icu-config --cppflags-searchpath`.strip
ICU_LD_FLAGS = (`icu-config --ldflags` +
`icu-config --ldflags-icuio`).gsub(/\n/, " ")
EI_INCLUDE_FLAGS = "-I#{`./findei.erl`.strip}/include"
EI_LD_FLAGS = "-L#{`./findei.erl`.strip}/lib -lei -lerl_interface"
task :default => [:app, :drv]
task(:app) do
sh %{erlc -o #{BLD} #{ERL_FILES}} do |ok, res|
if !ok
puts "erlc error, status = #{res.exitstatus}"
end
end
end
task(:drv) do
sh %{#{CC} #{DRV_FILES} -o #{File.join(PRV, "starling_drv")} #{ICU_INCLUDE_FLAGS} #{EI_INCLUDE_FLAGS} #{ICU_LD_FLAGS} #{EI_LD_FLAGS}} do |ok, res|
if !ok
puts "gcc error, status = #{res.exitstatus}"
end
end
end
task(:clean) do
Dir["ebin/*.beam"].each { |x| rm x rescue nil }
rm File.join("priv", "starling_drv") rescue nil
end