Skip to content

Commit

Permalink
translator: rearrange code in kotstd, fix makefiles and run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alejes committed Sep 2, 2016
1 parent c1b8bcb commit a53e173
Show file tree
Hide file tree
Showing 29 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ proto/compiler/google/src/google/protobuf/compiler/kotlin/bin
proto/compiler/google/src/google/protobuf/compiler/kotlin/protoc

# translator auto generated artifacts
kotstd/lib/arm/memory.ll
kotstd/ll
7 changes: 2 additions & 5 deletions kotstd/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

BUILD_DIR=$(PWD)/build
INCLUDE_DIR=$(PWD)/include
LIB_DIR=$(PWD)/lib
LIB_DIR=$(PWD)/ll
LIB_ARM_DIR=$(LIB_DIR)/arm
LIB_X86_DIR=$(LIB_DIR)/x86
LIBC=$(PWD)/libc
LIBC=$(PWD)/c
LLVM_ARM_FILES = $(patsubst $(LIBC)/%.c,$(LIB_ARM_DIR)/%.ll,$(wildcard $(LIBC)/*.c))
LLVM_X86_FILES = $(patsubst $(LIBC)/%.c,$(LIB_X86_DIR)/%.ll,$(wildcard $(LIBC)/*.c))

Expand Down Expand Up @@ -53,8 +53,5 @@ clean:
rm -rf $(BUILD_DIR)
rm -rf $(LIB_DIR)

aaa:
@echo $(LLVM_ARM_FILES)

.PHONY: all clean

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 11 additions & 2 deletions translator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ stdlib:
tests: stdlib $(OBJECTS)
@date

.DEFAULT_GOAL := tests

.PHONY: tests, stdlib
build:
./gradlew jar

all: build tests;

clean:
./gradlew clean

.DEFAULT_GOAL := all
.FORCE: build, all
.PHONY: tests, stdlib, build, all
3 changes: 2 additions & 1 deletion translator/run_one_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ green='\033[0;32m'
red='\033[0;31m'
lightRed='\033[1;31m'
orange='\033[0;33m'
KOTSTD='../kotstd/kt'

cd ../translator

Expand Down Expand Up @@ -57,7 +58,7 @@ if [ -f "$DIRECTORY/$TEST/$TEST.c" ]
fi
fi

java -jar build/libs/translator-1.0.jar -I ../kotstd/include $DIRECTORY/$TEST/$TEST.kt > $DIRECTORY/$TEST/linked/$TEST.ll
java -jar build/libs/translator-1.0.jar -I $KOTSTD $DIRECTORY/$TEST/$TEST.kt > $DIRECTORY/$TEST/linked/$TEST.ll

if [ $? -ne 0 ]; then
echo -e "${orange}test: ${TEST}${nc}"
Expand Down
3 changes: 2 additions & 1 deletion translator/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ red='\033[0;31m'
lightRed='\033[1;31m'
orange='\033[0;33m'
nc='\033[0m'
KOTSTD='../kotstd/kt'

if [ "$3" == "--debug" ]; then
cd ../kotstd && make clean && make debug
Expand Down Expand Up @@ -74,7 +75,7 @@ for i in $TESTS; do
fi
fi

java -jar build/libs/translator-1.0.jar -I ../kotstd/include $DIRECTORY/$TEST/$TEST.kt > $DIRECTORY/$TEST/linked/$TEST.ll
java -jar build/libs/translator-1.0.jar -I $KOTSTD $DIRECTORY/$TEST/$TEST.kt > $DIRECTORY/$TEST/linked/$TEST.ll

if [ $? -ne 0 ]; then
echo -e "${red}Translation error: ${DIRECTORY}/$TEST/${TEST}.kt${nc}"
Expand Down

0 comments on commit a53e173

Please sign in to comment.