[kaffe] Rewriting class library compilation
robilad at yahoo.com
Mon Feb 3 06:41:01 PST 2003
I've checked in my new implementation today. It's
working with jikes & kjc on i686-linux, and I assume
it will work with javac, too.
Here's the significant bit from
How do I adapt the class library to my needs?
If you are using kaffe on an embedded system, you may
want to use only
a part of the functionality provided by the class
example, you may not need JAXP or AWT on your system.
So you shouldn't
have to waste space on the device by including classes
you are not
going to use.
Kaffe supports user defined class library profiles. It
works on two
levels of indirection: a profile file tells the build
process where to
find lists of files to be compiled in a single
compiler run. The
compiler then compiles the listed files.
Let's take a look at the default profile in
libraries/javalib/profiles/default/profile . It lists
a few sets of
files needed to compile the class library. Among them
there is a set
of files needed for AWT support, another for JAXP
Each of these sets is a simple list of java source
files that should
be compiled together in a compiler run. They are
passed to the
compiler using the @file-containing-a-list-of-sources
option, so that
it works on systems with small maximal command line
In order to remove the AWT classes from your class
library, you can
simply remove the line with awt.files from the
In order to remove single classes from your class
library, you can
remove them from the respective lists of files they
are in. This may
cause the compilation of other classes to fail, so
check the compiler
output to make sure the compilation still worked.
How do I add classes to a class library profile?
If you want to add a class to specific compiler run,
just add the path
to its source to the file listing the classes to be
compiled in that
If you want to add a set of classes, you should add a
new compiler run
in the profile, and list paths to the sources in a
You should still consider adding the classes to
order to have the changes automatically picked up by
the build system.
How do I add my own class library profile?
Just make a new directory with your profile's name in
libraries/javalib/profiles and create a file named
'profile' in the
In order to make your life easier, kaffe automatically
essential files needed for java.lang.Object using the
list of files in
libraries/javalib/essential.files . So you don't have
to re-list those
files, but doing so won't hurt. It just helps you to
get started by
allowing you to focus on creating your library profile
getting java.lang.Object to compile.
Kaffe also automatically takes care about picking the
You can use the minimal profile as your starting
point. It compiles no
further files, beside those automatically compiled in.
You can either
add the classes at once, and add more tofix any
compiler error, or you
can use a tool like jakarta BCEL's transitive hull
verifier on the
root class of your application and add all the classes
traverses. That's what I did to get the list of
essential files. I
started with java.lang.Object. If you are using BCEL's
may need to add some interfaces by hand.
If you create some profiles that you consider to be of
others, please consider sending them to the Kaffe
mailing list on
kaffe at kaffe.org .
How do I pick which class library profile to use?
The configure script has the option
which allows you to specify a profile to use for the
--- Patrick Tullmann <tullmann at cs.utah.edu> wrote:
> address this. But your approach is what I had been
> thinking of. The
> only downside I foresaw is the automake packaging
> stuff that might
> get angry about not having a list of files visible
> in the Makefile.am
> (for generating tar files, etc) -- I don't know
> enough about automake
> to know if that's really a problem, though.
Yeah, I've left the Klasses_jar_SRCS in Makefile.am
for that reason. I don't know how to include the plain
file lists from libraries/javalib/proifiles/default/
into Makefile.am in a way that doesn't break them for
Maybe setting Klasses_jar_SRCS = `find -name "*.java"
-print "%p "` could work. But that would require the
system to have a find utility installed, and it may be
a GNU extension, I don't know.
> I think it should work great in terms of
> compilations and making
> Kaffe's java build system easier to work with.
> You might think about making the pass description
> files (or files
> generated from them) make-compatible so you can just
> do a make-level
> "include". That might get you better dependency
> support (or it might
> just be a PITA).
I think it's a PITA ;) From what I've seen, one can
either put the contents of a Klasses_jar_SRCS on a
single line, like
some_SRCS=a s d f g h
or on separate lines ending with '\'.
A file listing in a single line is really ugly to work
with. I'm not sure if java compilers accept the second
syntax, though. I doubt it, but I haven't tested it.
As usual, there are probably a ton of things that
could be made better. Take the chance and send me your
patches, bug reports, flames or congratulations. ;)
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
More information about the kaffe