Created
November 20, 2009 03:06
-
-
Save fujiwara/239255 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/perl | |
use strict; | |
use warnings; | |
my $source = shift; | |
unless ($source) { | |
print "no source. exec goshell\n"; | |
exec("goshell"); | |
} | |
my $go = $ENV{GOARCH} eq "386" ? "8" | |
: $ENV{GOARCH} eq "amd64" ? "6" | |
: $ENV{GOARCH} eq "arm" ? "5" | |
: die "invalid GORACH=$ENV{GOARCH}"; | |
(my $obj = $source) =~ s/\.go$/.${go}/; | |
my $compile = "${go}g"; | |
my $link = "${go}l"; | |
my $cmd = "./${go}.out"; | |
system($compile, $source) == 0 | |
and system($link, $obj) == 0 | |
and exec($cmd, @ARGV); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment