Hi,
I've finally managed to build dependencies for a set of .java
source files. However, I'm still scratching my head about how
to write compile rules.

In general, one can have some source files, say

   A.java
   some-sub/B.java

that depend on one another, i.e. must compile together, and result
in several output files

   sub/A.class
   sub/A$Inner.class
   yet-another-sub/B.class

It is good practice to confine source files in directories matching
the middle part of the path, e.g.

   classes/some/where/a.class: sources/some/where/a.java

but compilers don't usually enforce that. Even then, there is no
obvious source to classfile(s) relationship. So, I couldn't find
a better rule than

   %.u:
        $(JAVACOMPILE) $(filter %.java, $^)
        echo timestamp > $@

Where dependencies for groups should (IMHO) be written as

   sub/A.u: A.java some-sub/B.java
   sub/A.class: sub/A.u
   sub/A$$Inner.class: sub/A.u
   yet-another-sub/B.class: sub/A.u
   sub/A.u: stand-alone-requisites.class

The above stuff apparetly works. It is possible to write
rules that depend on specific classes, typically to generate
C include files from class files.

However, I'm concerned about make not knowing what files are
being generated. Is there a better way to issue JAVACOMPILE?
Is there a way to write dependencies so as to avoid subsequent
$filter-ing?

I've been googling a while around this subject and concluded
patching jikes (patch #451) to generate dependencies as above
(well, nearly as above: inner classes are not showing yet.)
Dependencies may go into a single dependency file or into
several %.u files, one for each group, for generating
dependencies while compiling. (Obviously one should not echo
the timestamp in the latter case...) More flags allow to get
the original (ungrouped) output and to use forward slashes on
win32. I welcome any suggestion/comment on that patch.

TIA
Ale


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to