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:
go build
install: build
go install
chmod +x bin/*
cp bin/* /usr/local/bin
ln -f -s $(GOROOT)/bin/gowllvm $(GOROOT)/bin/gowclang
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"
)
func compile(args []string) {
if len(args) < 1 {
log.Fatal("You must precise which compiler to use.")
}
var compilerName = args[0]
func compile(args []string, compilerName string) {
var compilerExecName = getCompilerExecName(compilerName)
var configureOnly bool
if os.Getenv(CONFIGURE_ONLY) != "" {
configureOnly = true
}
args = args[1:]
var pr = parse(args)
// If configure only is set, try to execute normal compiling command then exit silently

View File

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