# Makefile for compiling the Charva library with the GNU Compiler for Java
# (GCJ), contributed by Nick Liebmann.
# Tested on Red Hat Linux with gcj version 3.2.2.

# Use the "library" target to compile all the class files in "charva.jar" into
# a shared library named "libcharva.so". Of course, you need to run
# "ant dist" (to make charva.jar) and "ant makeDLL" (to make libTerminal.so)
# before running this Makefile.

library :
	gcj java/dist/lib/charva.jar -shared -fjni -o c/lib/libcharva.so


# Use this target to compile the Tutorial application into an executable
# named "charvatutgcj".
charvatutgcj :
	gcj -Ijava/dist/lib/charva.jar \
	-Lc/lib -lcharva -lTerminal \
	-ggdb --main=tutorial.charva.Tutorial \
	-o charvatutgcj \
	java/test/src/tutorial/charva/Tutorial.java

# To run the compiled and linked tutorial application on Linux, type the
# following commands. The LD_LIBRARY_PATH environment variable has to be
# set otherwise Linux can't find the libcharva.so and libTerminal.so shared
# libraries.
# Of course, you can also just copy these libraries to your system's library
# directory.
#
#
#	$ export LD_LIBRARY_PATH=`pwd`/c/lib
#	$ ./charvatutgcj
