Skip to content

Commit c62fe4e

Browse files
committed
add mac build bash
1 parent a8b0112 commit c62fe4e

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
./class2ir/target
33
./class2ir/.idea
44
./app/out/classes
5-
./app.exe
5+
./a.out
6+
./app/c/*.ll
7+

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ This project is based on [class2ir](https://github.com/MParygin/class2ir), that
77
So I've changed some instruction syntex, and repaired bug, enhanced functional.
88

99
### Currently:
10-
Generated CentOS x64 executable file, and say "Hello world".
10+
Generated CentOS_x64 and MacOS executable file, and say "Hello world".
1111

1212
### Make:
1313
1. Enter directory java2llvm/
14-
2. Run build.sh, then you will get app.exe here.
14+
2. Run mac_build.sh or centos_build.sh , then you will get a.out here.
1515

1616
### Requirements:
1717
CentOS 7.0 x86_64

app.exe

-94.6 KB
Binary file not shown.

build.sh renamed to centos_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ java -cp ./class2ir/dist/class2ir.jar:./class2ir/lib/asm-7.2.jar:./class2ir/lib/
55

66
cd ./app/c/
77
make
8-
cp ./c ../../app.exe
8+
cp ./c ../../a.out
99
make clean
1010
cd ../../
1111
rm -rf ./app/out/classes/*

mac_build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
echo need : java llvm-gcc
2+
3+
echo compile java source *.java and convert to llvm ir file *.ll
4+
java -cp ./class2ir/dist/class2ir.jar:./class2ir/lib/asm-7.2.jar:./class2ir/lib/classparser.jar j2ll.Main ./app/java ./app/out/classes ./app/c/
5+
6+
cd ./app/c/
7+
llvm-gcc *.c *.ll
8+
cp ./a.out ../../a.out
9+
rm *.ll a.out
10+
cd ../../
11+
rm -rf ./app/out/classes/*
12+
rm -rf ./class2ir/target
13+
echo success

0 commit comments

Comments
 (0)