JAVA_DEV_ROOT | set this such that $JAVA_DEV_ROOT/xtc is the top-level xtc directory |
---|---|
PATH_SEP | ':' for MacOS or Linux, or ';' for Cygwin |
CLASSPATH | $JAVA_DEV_ROOT/classes$PATH_SEP$JAVA_DEV_ROOT/bin/junit.jar$PATH_SEP$JAVA_DEV_ROOT/bin/antlr.jar |
JAVA_HOME | set this such that $JAVA_HOME/bin/java is the Java virtual machine |
CPATH | should include the directory that contains jni.h, which is most likely $JAVA_HOME/include |
PATH | should include $JAVA_HOME/bin |
OSTYPE | should be either cygwin, or have linux or darwin as a substring |
make -C $JAVA_DEV_ROOT/fonda/jeannie_testsuite test_000If all goes well, that should produce the output:
==== integration test_000 ==== Processing tmp/000sugared/Main.jni ... diff tmp/000mangled/output.txt tmp/000sugared/output.txtWhat happened is that the Makefile compiled and ran the same test written in Jeannie (fonda/jeannie_testsuite/input/000sugared_Main.jni) and in JNI (fonda/jeannie_testsuite/input/000mangled_Main.{c,java}), and compared the output. You can also run all included integration tests in batch mode:
make -C $JAVA_DEV_ROOT/fonda/jeannie_testsuite testTo find out the individual compilation steps, uncomment the following line in the Makefile:
# export VERBOSE_MAKE=true
java -ea xtc.lang.jeannie.PreJeannieParser foo/Main.jni > foo/Main.jni.pp
# Mac OS: cc -DSPECIALIZE_RELPROD -DSPECIALIZE_AND -DSPECIALIZE_OR -DSMALL_NODES -U__BLOCKS__ -fomit-frame-pointer -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers -E -x c foo/Bar.jni.pp > foo/Bar.jni.i # Linux: gcc -E -x c foo/Bar.jni.pp > foo/Bar.jni.i # Cygwin: gcc -mno-cygwin -I$JAVA_HOME/include -E -x c foo/Bar.jni.pp > foo/Bar.jni.i
# Mac OS or Linux: java -ea -DJNICALL='' xtc.lang.jeannie.Jeannie -analyze -translate -in foo foo/Bar.jni.i # Cygwin: java -ea -DJNICALL='__attribute__((__stdcall__))' xtc.lang.jeannie.Jeannie -analyze -translate -in foo foo/Bar.jni.i
# Mac OS: cc -DSPECIALIZE_RELPROD -DSPECIALIZE_AND -DSPECIALIZE_OR -DSMALL_NODES -U__BLOCKS__ -fomit-frame-pointer -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers -dynamiclib -framework JavaVM -o foo/libBar.jnilib foo/Bar.i # Linux: gcc -shared -o foo/libBar.so foo/Bar.i # Cygwin: gcc -mno-cygwin -I$JAVA_HOME/include -Wl,--add-stdcall-alias -shared -o foo/Bar.dll foo/Bar.i
javac -sourcepath foo -d foo foo/Bar.java
export PATH=foo:"$PATH" export LD_LIBRARY_PATH=foo:"$LD_LIBRARY_PATH"
java -cp foo -Djava.library.path=foo Bar