Re: Java and 'make'
- From: "Daniel Dyer" <"You don't need it">
- Date: Sat, 02 Jun 2007 23:58:46 +0100
On Sat, 02 Jun 2007 23:38:03 +0100, <veegnu@xxxxxxxxx> wrote:
Hello,
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.
The obvious first question is why make and not Ant (http://ant.apache.org)?
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?
Generally you would not compile individual source files. You should compile both files at the same time because javac cannot resolve the dependency otherwise:
javac Node.java NetworkPacket.java
Or
javac *.java
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.
Use Ant unless you have a compelling reason not to.
Dan.
--
Daniel Dyer
http//www.uncommons.org
.
- References:
- Java and 'make'
- From: veegnu
- Java and 'make'
- Prev by Date: About EJB or RMI
- Next by Date: Re: Java and 'make'
- Previous by thread: Java and 'make'
- Next by thread: Re: Java and 'make'
- Index(es):
Relevant Pages
|