kissme build system 2000-06-26
----------------------------------------

The build system is a bit eccentric, I have my reasons though. 

1 Layout:
----------

From the top level directory we have two important dirs:

vm/ 	Contains the code for the interpreter
lib/	Contains native code for the class libraries and interpreter

Going down:

vm/*.c		The guts of the interpreter, memory management, most of threads etc
vm/garbage/	Now holds most of the GC code
vm/interp/	Now holds all the code for the interpreter loop and utility functions

lib/classpath	Native code from the classpath library
lib/indigenous	Homegrown code used mostly before classpath came about, still important for java.lang.reflect, java.lang and plava


lib/indigenous/jeps	Just code for a native TCP/IP stack written in java
lib/indigenous/plava	Code for the persistence functionality. Just allows programs to control the persistent store
lib/indigenous/gnu.vm.stack.kludge/	Code for getting stack traces for exceptions
lib/indigenous/jos.system/	Native methods to access i386 ports and stuff, for use with the JOS operating system
lib/indigenous/pygmalion/	A half-hearted attempt at doing some AWT support

lib/classpath/			All the classpath stuff. This is still from a fairly old CVS checkout.

2 Building:
---------------

For various reasons I have moved away from GNU make and written my own make utility. GNU make just wasn't flexible in the way I needed it to be. The current make utility is called makeme, and it resides in gnu.makeme. I have a script to run a build:

[jewel@svetlana current]$ cat /usr/local/bin/makeme
#! /bin/sh
# Script to run the MakeMe make utility
/usr/jdk118/bin/java -classpath /usr/jdk118/lib/classes.zip:/home/jewel/java:/home/jewel/java/kopi/temp -nojit gnu.makeme.MakeMe $@

It just invokes the interpreter with the gnu.makeme.MakeMe program and makes sure it can access the ANTLR files.

2.1 ANTLR:
----------

ANTLR is a compiler compiler written in java. I use the version from the KOPI project: http://www.dms.at/kopi/kopi.html .

Just install it somewhere, you can see I have it in /home/jewel/java/kopi/temp .

2.2 Running makeme
--------------------

To run the make utility just execute the script, I just type "makeme" in the top-level directory of kissme.

3 Configuring makeme
--------------------

Makeme uses "Makefiles" called ".makeme". 

They are much simpler than "Make" makefiles, the top-level .makeme file has:

BuildRule b1 = "gcc -Wall -c -g -O0 -I. -Ivm -I./include -I@curdir@ @full_path_source@ -o @full_path_target@ "
LinkRule link1 = "gcc -o kissme -lm -lgmp -lpthread -ldl @object_files@ "

Subdir sident = "vm"
Subdir sident2 = "lib"
Subdir sident3 = "extra"
CProgram kissme = " "
var glibstuff="-I/usr/lib/glib/include/ "
;

The BuildRule indicates a build rule to use when compiling this project. The variable name b1 doesn't really mean anything, but it has to be there. You can use the variables @curdir@, @full_path_source@ and @full_path_target@. They evaluate to the current directory, the source file being compiled and the resulting object (class) file respectively.

The LinkRule links the program, the variable @object_files@ expands to a list of all targets that would be built. In this case all the .o files.

The Subdir statements indicate subdirectories which the build should recurse into. In each of these it looks for a .makeme file. It preserves the build rule (to save retyping it), but you can also override the build rule.

The CProgram declaration tells makeme we are building a C program. The other option is JavaProgram.

You can also define your own variables, like the 'var glibstuff'. 

You must end the file with a ;

4 Caveats:
---------------

The main interpreter loop, interp_loop.c includes some header files for the big interpreter switch statement. When you modify these header files the build program won't know to rebuild interp_loop.o. You'll have to touch it or delete it to force this.

[EOF]
