translator: add fast build in executable file

This commit is contained in:
Alexey Stepanov
2016-09-05 20:50:12 +03:00
parent 7e5c4672f9
commit 3dc93dc86c
2 changed files with 27 additions and 2 deletions
+15 -2
View File
@@ -6,9 +6,11 @@ red = '\033[0;31m'
lightRed = '\033[1;31m'
orange = '\033[0;33m'
nc = '\033[0m'
KOTSTD='../kotstd'
SOURCELIB=build/sources
stdlib:
cd ../kotstd && make clean && make
cd $(KOTSTD) && make clean && make
%.out: stdlib %.txt
@./run_one_test.sh $(@:.out=.txt)
@@ -25,6 +27,17 @@ all: build tests;
clean:
./gradlew clean
compile: build
mkdir -p $(SOURCELIB)
rm -f $(SOURCELIB)/linked.ll
rm -f $(SOURCELIB)/linked.ll
java -jar build/libs/translator-1.0.jar -I $(KOTSTD)/kt $(files) -o $(SOURCELIB)/build.ll
llvm-link-3.6 -S $(KOTSTD)/build/stdlib_x86.ll $(SOURCELIB)/build.ll >> $(SOURCELIB)/linked.ll
clang-3.6 $(SOURCELIB)/linked.ll -o $(output)
rm $(SOURCELIB)/linked.ll
rm $(SOURCELIB)/build.ll
.DEFAULT_GOAL := all
.FORCE: build, all
.PHONY: tests, stdlib, build, all
.PHONY: tests, stdlib, build, all, compile
+12
View File
@@ -1,5 +1,16 @@
# Translator from Kotlin to LLVM
## Fast build
If you want to use the translator without going into any technical details, this section is for you. Using following commands you will be able to compile your Kotlin files, the resulting executable file
$ make compile files=$(KTFILES) output=$(OUTPUT)
where
- $(KTFILES) - list of your Kotlin files separated by spaces
- $(OUTPUT) - the resulting file
**NOTE:** when you use a fast build, the name of your your entry point function must be **main** and it should not receive arguments
## Building
For build translator into jar, you must run gradle target
@@ -50,3 +61,4 @@ where $(COMPILED_LLVM_CODE) - code obtained in the step compiler
$ lli-3.6 $(LINKED_CODE)
where $(LINKED_CODE) - code obtained in the previous step