ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Newbie question
Date Wed, 09 May 2001 06:54:40 GMT
M. Nair <manojnair@mediaone.net> wrote:

> I come from the "make" school of building a system and have a few
> questions on how the same could be achieved using ant.

Some concepts are quite different between Ant and make and unless you
adapt to Ant's way (at least a little), you probably won't become too
happy with Ant.

> (a) In Make, I could use the if [ -r *.xyz ] do blah blah blah...How
> can I do the same using ant?

The best way would probably be to write a custom task to do this in
one step.  Otherwise, do something like

<target name="check">
  <available file="triggering-file" property="file-is-there" />
</target>

<target name="do" depends="check" if="file-is-there">
  do blah blah blah
</target>

> (b) How can I set ant up so that one can simulate the recursive
> make?

Several options are available

The built-in one: Use <ant> and hardcode the locations of all subbuild
files.

The preprocessor option: Autogenerate your top level build file by
some means (which will then use <ant> and hardcoded names) - see
M.J.P. van Leeuwen's Configure (link at
<http://jakarta.apache.org/ant/external.html>) for a way to do this.

The <anton> or <foreach> option: Ant2 will have a task named <anton>
that can invoke the same target in a couple of build files (specified
using patterns) - maybe the very next version of Ant will already have
something similar.  Tim Vernum has written a Task named <foreach> that
does the same, you can find it in the archives of the ant-dev list.

> (c) I have a rules.mk when I build stuff using Make - how can one
> include an ant rules file(if one can be created) ?

I'm not familiar enough with make to know what a rules file might be.
As far as including is concerned, a very rudimentary approach is
described here <http://jakarta.apache.org/ant/faq.html#xml-entity-include>.

Stefan

Mime
View raw message