This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: how to help? help me!


Hi Kho,

>>>> You can emit dependecy lists by incrementally compiling
your source tree and specify -MM to gcj (there are some other options
too).

That sounds interesting. How does the -MM work then?

I currently compile sourcetrees using a different procedure.

First, I use jikes to create a corresponding cls tree:

<target name="cls-compile" depends="init">
    <property name="build.compiler" value="jikes"/>
        <javac srcdir="src" destdir="cls" classpath="lib" includes="
			**/*.java"/>
</target>

lib contains a copy of libjava-3.2.jar.

By the way, jikes is blazingly fast; but is there a way to avoid double
compilation? At this point, without jikes, I wouldn't have anything to
supply as a classpath to GCJ. I haven't been able to instruct GCJ to produce
its own classpath information.

Then I use the jikes-produced clstree as classpath for gcj, and I compile to
*.o files:

        <apply executable='gcj' dest='obj'>
            <arg value='-fCLASSPATH=cls/'/>
            <arg value='-c'/>
            <arg value='-Os'/>
            <srcfile/>
            <arg value='-o'/>
            <targetfile/>
            <fileset dir='src/'>
	</fileset>
            <mapper type='glob' from='*.java' to='*.o'/>
        </apply>

By the way, gcj will not create the output directory, if it doesn't exist.
Is there a way to instruct Ant to create a corresponding directory tree? I
mean, a directory structure in obj that corresponds to the directory
structure in src. Currently, I do it manually.

Then I link the *.o files produced:

        <apply failonerror="true" executable="gcj" parallel="true">
            <fileset dir="obj/" includes="**/*.o"/>
            <arg value="--main=MyMain"/>
            <arg value='-s'/>
            <arg value='-Os'/>
            <arg line="-o exe/myexecutable.exe"/>
            <srcfile/>
       </apply>

You know what would really help? If GCJ could simply take a source tree as
argument and produce a corresponding *.o tree. Then all these shellscripts,
makefiles, special Ant tasks and so on, would not be needed. It would
tremendously simplify the compilation procedure. And traditional Java
development is done in that way anyway: an src tree is just compiled to a
corresponding cls tree. For native compilation, an src tree would simply
have to be compiled to a corresponding obj tree.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]