Created
November 15, 2009 18:26
-
-
Save duckinator/235382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'shell' | |
def err(s) | |
puts s | |
exit 1 | |
end | |
shell = Shell.new | |
bits = 64 | |
err "Usage: ./build APP_NAME" if !ARGV[0] | |
app = ARGV[0] | |
dir = "/home/#{ENV['USER']}/dev/asm/#{app}" | |
err "Directory does not exist: #{dir}" if !File.exist? (dir) | |
err "Not a directory: #{dir}" if !File.directory? (dir) | |
bits = 32 if IO.readlines("#{dir}/#{app}.s")[0] =~ /;32/ | |
shell.cd(dir) | |
shell.transact { | |
shell.system("nasm -felf#{bits} #{app}.s -o #{app}.o") | |
shell.system("ld #{app}.o -o #{app}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment