aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder/cc.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-03-12 17:14:42 +0100
committerRon Evans <[email protected]>2021-04-05 20:52:04 +0200
commit896a848001c511a20ad6ef3fd8175cd18b448fe5 (patch)
tree56e570838ab319421c756f40c95ae86ddf605917 /builder/cc.go
parentfb03787b73ff62f4dcab767e8f10d19f4e747c8d (diff)
downloadtinygo-896a848001c511a20ad6ef3fd8175cd18b448fe5.tar.gz
tinygo-896a848001c511a20ad6ef3fd8175cd18b448fe5.zip
builder: add support for -x flag
Print commands as they are executed with the -x flag. This is not yet complete: library builds don't print commands yet. But it's a step closer.
Diffstat (limited to 'builder/cc.go')
-rw-r--r--builder/cc.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/builder/cc.go b/builder/cc.go
index 89dd7ca50..3f78ce007 100644
--- a/builder/cc.go
+++ b/builder/cc.go
@@ -124,6 +124,9 @@ func compileAndCacheCFile(abspath, tmpdir string, config *compileopts.Config) (s
flags := config.CFlags()
flags = append(flags, "-MD", "-MV", "-MTdeps", "-MF", depTmpFile.Name()) // autogenerate dependencies
flags = append(flags, "-c", "-o", objTmpFile.Name(), abspath)
+ if config.Options.PrintCommands {
+ fmt.Printf("%s %s\n", config.Target.Compiler, strings.Join(flags, " "))
+ }
err = runCCompiler(config.Target.Compiler, flags...)
if err != nil {
return "", &commandError{"failed to build", abspath, err}