translator: add fast build in executable file
This commit is contained in:
+15
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user