Re: Java and 'make'



veegnu@xxxxxxxxx wrote:
I have a question about using make as the build-utilitiy for Java
programs. Please point me to a more appropriate news group if this is
not the group to discuss this.

Here is the context of my question:
------------------------------------------
A 'Node' contains NetworkPackets. NetworkPackets have a source Node.
My makefile captures this as:

...
Node.class: Node.java NetworkPacket.class
javac Node.java

NetworkPacket.class: NetworkPacket.java Node.class
javac NetworkPacket.java
...

First issue:
------------
With this, make discovers a cyclic dependency and drops it. I am sure
that per the design of make, this is expected behavior. The question
is, how should I represent the dependency in my program in a makefile?

Second issue:
-------------
I believe make will not have problems of this kind in the context of C/
C++ programs. Because of a clear seperation of declarations in a
header file and definitions in object files, the dependencies will
form 'trees' instead of 'cycles' as in the makefile snipped above. Is
makefile not the appropriate (or the best) tool to capture
dependencies in Java programs where we don't have a seperate header
and source files? My experience with make is limited to relatively
uncomplicated scenario and I would like to have the opinion of more
knowledgeable people on this point.

1)

I would suggest you try compiling all the java files in a dir with
one command:

javac *.java

2)

ant (http://ant.apache.org/) is a much better build tool than
make for Java.

Arne
.



Relevant Pages

  • Re: Java and make
    ... I have a question about using make as the build-utilitiy for Java ... My makefile captures this as: ... javac NetworkPacket.java ... make discovers a cyclic dependency and drops it. ...
    (comp.lang.java.programmer)
  • Java and make
    ... I have a question about using make as the build-utilitiy for Java ... Please point me to a more appropriate news group if this is ... My makefile captures this as: ... make discovers a cyclic dependency and drops it. ...
    (comp.lang.java.programmer)
  • Re: Separate Compilation in Programming Languages
    ... It might indicate a problem with the GNAT implementation, ... with Ada. ... However, I have not programmed any large-scale programs in Java, ... the dependency problems become more ...
    (comp.lang.ada)
  • Re: Javas performance far better that optimized C++
    ... Java dependency checkers have to be ... java tools are capable of analyzing code much more smartly ... > management feature of some languages that don't have deterministic ... It it needed for programmers not to forget to deallocate resources. ...
    (comp.lang.cpp)
  • Re: Strange behavior with Make dependencies...
    ... Make will check if the timestamp of the bootsect directory is ... so simple existence will skip the commands. ... add a dependency on the Makefile). ...
    (comp.unix.programmer)