aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-06-07 14:48:24 +0200
committerAyke van Laethem <[email protected]>2018-06-07 14:48:24 +0200
commit0168bf7797c0865e10e3cf92028aa6e5931572dd (patch)
treeb7e9872c68d7de461871d93bd27a63c151cbe76a /Makefile
parent8df220a53b049871dca56c2ef45437e0ccd0ffd9 (diff)
downloadtinygo-0168bf7797c0865e10e3cf92028aa6e5931572dd.tar.gz
tinygo-0168bf7797c0865e10e3cf92028aa6e5931572dd.zip
Add goroutines and function pointers
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 507075dc9..8af76c44d 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ LLVM := $(shell go env GOPATH)/src/github.com/aykevl/llvm/bindings/go/llvm/workd
LINK = $(LLVM)llvm-link
LLC = $(LLVM)llc
LLAS = $(LLVM)llvm-as
+OPT = $(LLVM)opt
CFLAGS = -Wall -Werror -Os -g -fno-exceptions -flto -ffunction-sections -fdata-sections $(LLFLAGS)
@@ -72,10 +73,15 @@ build/tgo: *.go
@mkdir -p build
go build -o build/tgo -i .
-# Build textual IR with the Go compiler.
-build/%.o: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc
+# Build IR with the Go compiler.
+build/%.bc: src/examples/% src/examples/%/*.go build/tgo src/runtime/*.go build/runtime-$(TARGET)-combined.bc
./build/tgo $(TGOFLAGS) -printir -runtime build/runtime-$(TARGET)-combined.bc -o $@ $(subst src/,,$<)
+# Compile and optimize bitcode file.
+build/%.o: build/%.bc
+ $(OPT) -coro-early -coro-split -coro-elide -O1 -coro-cleanup -o $< $<
+ $(LLC) -filetype=obj -o $@ $<
+
# Compile C sources for the runtime.
build/%.bc: src/runtime/%.c src/runtime/*.h
@mkdir -p build