Skip to content

Instantly share code, notes, and snippets.

@relrod
Created November 15, 2009 18:18
Show Gist options
  • Save relrod/235373 to your computer and use it in GitHub Desktop.
Save relrod/235373 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use warnings;
use strict;
die("Usage: ./build APP_NAME") if !$ARGV[0];
my ($dir,$appname) = ("~/dev/asm/".$ARGV[0],$ARGV[0]);
if((-d $dir and chdir($dir))) { # Directory exists.
open(SOURCEFILE,"<$dir/$appname.s");
my @lines = <SOURCEFILE>;
$b = ($lines[0] eq ';32') ? 32 : 64;
`nasm -felf$b $appname.s -o $appname.o && ld $appname.o -o $appname`;
} else {
die("Hey! That app doesn't exist, numbskull [or I can't chdir() to it]!\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment