mirror of
https://github.com/samsonjs/compiler.git
synced 2026-04-27 14:57:45 +00:00
fixed compiling. (had only been running tests which require and use the build method directly)
This commit is contained in:
parent
9d31c1e983
commit
558d5e73a9
1 changed files with 8 additions and 4 deletions
12
build.rb
12
build.rb
|
|
@ -8,14 +8,18 @@ require 'asm/machofile'
|
||||||
|
|
||||||
# usage: build.rb <filename> [elf | macho ] [asm | bin]
|
# usage: build.rb <filename> [elf | macho ] [asm | bin]
|
||||||
|
|
||||||
|
DefaultBinFormats = Hash.new('bin')
|
||||||
|
def binformat(p,f) DefaultBinFormats[p]=f end
|
||||||
|
binformat 'darwin', 'macho'
|
||||||
|
binformat 'linux', 'elf'
|
||||||
|
|
||||||
def main
|
def main
|
||||||
filename = ARGV[0].to_s
|
filename = ARGV[0].to_s
|
||||||
raise "can't read #{filename}" unless File.readable?(filename)
|
raise "can't read #{filename}" unless File.readable?(filename)
|
||||||
binformat = ARGV[1] ? ARGV[1].downcase : 'elf'
|
|
||||||
format = ARGV[2] ? ARGV[2].downcase : 'asm'
|
|
||||||
platform = `uname -s`.chomp.downcase
|
platform = `uname -s`.chomp.downcase
|
||||||
puts "Building #{format} from #{filename} for #{platform}, binformat is #{binformat} ..."
|
binformat = ARGV[1] ? ARGV[1].downcase : DefaultBinFormats[platform]
|
||||||
outfile = build(filename, platform, format, binformat)
|
puts "Building #{filename} for #{platform}, binformat is #{binformat} ..."
|
||||||
|
outfile = build(filename, platform, binformat)
|
||||||
puts outfile
|
puts outfile
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue