replace shell scripts by symlinks to call tool

This commit is contained in:
Loic Gelle 2017-06-26 13:08:15 -07:00
parent 50661706fd
commit 841cbca3c3
6 changed files with 14 additions and 25 deletions

View File

@ -1,7 +1,10 @@
GOROOT := $(shell go env GOPATH)
build: build:
go build go build
install: build install: build
go install go install
chmod +x bin/* ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowclang
cp bin/* /usr/local/bin ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowclang++
ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowextract

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec gowllvm compile clang "$@"

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec gowllvm compile clang++ "$@"

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec gowllvm extract "$@"

View File

@ -11,17 +11,12 @@ import (
"io" "io"
) )
func compile(args []string) { func compile(args []string, compilerName string) {
if len(args) < 1 {
log.Fatal("You must precise which compiler to use.")
}
var compilerName = args[0]
var compilerExecName = getCompilerExecName(compilerName) var compilerExecName = getCompilerExecName(compilerName)
var configureOnly bool var configureOnly bool
if os.Getenv(CONFIGURE_ONLY) != "" { if os.Getenv(CONFIGURE_ONLY) != "" {
configureOnly = true configureOnly = true
} }
args = args[1:]
var pr = parse(args) var pr = parse(args)
// If configure only is set, try to execute normal compiling command then exit silently // If configure only is set, try to execute normal compiling command then exit silently

View File

@ -8,18 +8,15 @@ import(
func main() { func main() {
// Parse command line // Parse command line
var args = os.Args var args = os.Args
if len(args) < 2 { var callerName = args[0]
log.Fatal("Not enough arguments.") args = args[1:]
}
var modeFlag = args[1]
args = args[2:]
switch modeFlag { switch callerName {
case "compile": case "gowclang":
// Call main compiling function with args compile(args, "clang")
compile(args) case "gowclang++":
case "extract": compile(args, "clang++")
// Call main extracting function with args case "gowextract":
extract(args) extract(args)
default: default:
log.Fatal("You should call gowllvm with a valid mode.") log.Fatal("You should call gowllvm with a valid mode.")