aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-04-27 17:31:50 +0200
committerRon Evans <[email protected]>2019-04-30 20:04:04 +0200
commit1d59a960bc326af3739348cc539982d4d2277b4b (patch)
tree7d972ecc6c5919afa852b8bbced8a2c8cee74ccc
parent5ca2e1322c33b0e2c0eaff95ae34b0a12c1d6cc3 (diff)
downloadtinygo-1d59a960bc326af3739348cc539982d4d2277b4b.tar.gz
tinygo-1d59a960bc326af3739348cc539982d4d2277b4b.zip
main: allow changing the clang command name
-rw-r--r--main.go12
-rw-r--r--targets/cortex-m.json2
-rw-r--r--targets/wasm.json2
3 files changed, 12 insertions, 4 deletions
diff --git a/main.go b/main.go
index 7bd025405..82ac31e80 100644
--- a/main.go
+++ b/main.go
@@ -211,7 +211,11 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
// Compile extra files.
for i, path := range spec.ExtraFiles {
outpath := filepath.Join(dir, "extra-"+strconv.Itoa(i)+"-"+filepath.Base(path)+".o")
- cmd := exec.Command(spec.Compiler, append(spec.CFlags, "-c", "-o", outpath, path)...)
+ cmdName := spec.Compiler
+ if name, ok := commands[cmdName]; ok {
+ cmdName = name
+ }
+ cmd := exec.Command(cmdName, append(spec.CFlags, "-c", "-o", outpath, path)...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = sourceDir()
@@ -227,7 +231,11 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
for _, file := range pkg.CFiles {
path := filepath.Join(pkg.Package.Dir, file)
outpath := filepath.Join(dir, "pkg"+strconv.Itoa(i)+"-"+file+".o")
- cmd := exec.Command(spec.Compiler, append(spec.CFlags, "-c", "-o", outpath, path)...)
+ cmdName := spec.Compiler
+ if name, ok := commands[cmdName]; ok {
+ cmdName = name
+ }
+ cmd := exec.Command(cmdName, append(spec.CFlags, "-c", "-o", outpath, path)...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = sourceDir()
diff --git a/targets/cortex-m.json b/targets/cortex-m.json
index eaba15953..e9db29788 100644
--- a/targets/cortex-m.json
+++ b/targets/cortex-m.json
@@ -2,7 +2,7 @@
"build-tags": ["cortexm", "linux", "arm"],
"goos": "linux",
"goarch": "arm",
- "compiler": "clang-8",
+ "compiler": "clang",
"gc": "marksweep",
"linker": "ld.lld",
"rtlib": "compiler-rt",
diff --git a/targets/wasm.json b/targets/wasm.json
index 8b5ed8553..4bde3b746 100644
--- a/targets/wasm.json
+++ b/targets/wasm.json
@@ -3,7 +3,7 @@
"build-tags": ["js", "wasm"],
"goos": "js",
"goarch": "wasm",
- "compiler": "clang-8",
+ "compiler": "clang",
"linker": "wasm-ld",
"cflags": [
"--target=wasm32",