Re: Java and 'make'
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Sat, 02 Jun 2007 19:00:57 -0400
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
.
- References:
- Java and 'make'
- From: veegnu
- Java and 'make'
- Prev by Date: Re: Java and 'make'
- Next by Date: Re: Tomcat error with bean
- Previous by thread: Re: Java and 'make'
- Next by thread: Re: Java and 'make'
- Index(es):
Relevant Pages
|