Skip to content

Commit

Permalink
cmd/llgo-build: add "-work" flag.
Browse files Browse the repository at this point in the history
This is mostly useful to keep the .o file around until there's a
proper solution for go-llvm#82.
  • Loading branch information
quarnster committed Oct 5, 2013
1 parent 7cfde94 commit c24b09a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/llgo-build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
workdir string
test bool
buildDeps bool = true
work bool
)

func init() {
Expand All @@ -41,6 +42,7 @@ func init() {
flag.BoolVar(&printcommands, "x", false, "Print the commands")
flag.BoolVar(&test, "test", test, "When specified, the created output binary will be similar to what's output of \"go test -c\"")
flag.BoolVar(&buildDeps, "build-deps", buildDeps, "Whether to also build dependency packages or not")
flag.BoolVar(&work, "work", work, "Print the name of the temporary work directory and do not delete it when exiting")
}

func main() {
Expand Down Expand Up @@ -74,6 +76,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
if work {
log.Println("Working directory:", workdir)
}
args := flag.Args()
if test {
if len(args) > 1 {
Expand All @@ -84,7 +89,9 @@ func main() {
} else {
err = buildPackages(args)
}
os.RemoveAll(workdir)
if !work {
os.RemoveAll(workdir)
}
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit c24b09a

Please sign in to comment.