From 558d5e73a9ea81099c127967afad29270175d303 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Wed, 13 Jan 2010 21:50:30 -0800 Subject: [PATCH] fixed compiling. (had only been running tests which require and use the build method directly) --- build.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.rb b/build.rb index ff724fc..24b454f 100755 --- a/build.rb +++ b/build.rb @@ -8,14 +8,18 @@ require 'asm/machofile' # usage: build.rb [elf | macho ] [asm | bin] +DefaultBinFormats = Hash.new('bin') +def binformat(p,f) DefaultBinFormats[p]=f end +binformat 'darwin', 'macho' +binformat 'linux', 'elf' + def main filename = ARGV[0].to_s 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 - puts "Building #{format} from #{filename} for #{platform}, binformat is #{binformat} ..." - outfile = build(filename, platform, format, binformat) + binformat = ARGV[1] ? ARGV[1].downcase : DefaultBinFormats[platform] + puts "Building #{filename} for #{platform}, binformat is #{binformat} ..." + outfile = build(filename, platform, binformat) puts outfile exit end