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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/rub/l/ld/linker/clang.rb', line 42
def self.link_command(opt, files, libs, out, format)
files = R::Tool.make_set_paths files
libs = R::Tool.make_set libs
out = C.path(out)
c = [find, "-o#{out}"]
c << opt.args
c << case format
when :exe
[]
when :shared
['-shared']
else
raise "Unknown/unsupported output #{format}."
end
c << case opt.optimize
when :none
'-O0'
when :some
'-O2'
when :full
'-O3'
when :max
'-O4'
else
raise "Invalid optimization level #{opt.optimize}."
end
c << if opt.static
'-static'
else
[]
end
c << opt.library_dirs.map{|d| "-L#{d}"}
c << libs.map{|l| "#{l}" }
c << files.to_a
c.flatten
end
|