mirror of
https://github.com/danog/gllvm.git
synced 2025-01-23 00:21:10 +01:00
replace shell scripts by symlinks to call tool
This commit is contained in:
parent
50661706fd
commit
841cbca3c3
7
Makefile
7
Makefile
@ -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
|
||||
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec gowllvm compile clang "$@"
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec gowllvm compile clang++ "$@"
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec gowllvm extract "$@"
|
@ -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
|
||||
|
19
gowllvm.go
19
gowllvm.go
@ -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.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user