mirror of
https://github.com/danog/gllvm.git
synced 2025-01-23 06:01:24 +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:
|
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
|
||||||
|
@ -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"
|
"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
|
||||||
|
19
gowllvm.go
19
gowllvm.go
@ -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.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user