Hmm, I tried this and it doesn't seem to work due to the funky way
backticks evaluation usually works in shells. I tried the following and
got the following output :
$ cat build.xml
<?xml version="1.0" ?>
<project name="Template" default="printhelp" basedir=".">
<!-- prints out help -->
<target name="printhelp" description="Prints out usage help">
<echo>Usage: ant -Dparameter=blah</echo>
<exec executable="/bin/sh">
<arg value="-c" />
<arg value="echo `gnome-config --cflags` -o somefile.o
somefile.c" />
</exec>
</target>
</project>
$ ant -verbose
Ant version 1.3 compiled on March 2 2001
Buildfile: build.xml
Detected Java Version: 1.2
Detected OS: SunOS
parsing buildfile /scratch/mick/AntTest/build.xml with URI =
file:/scratch/mick/AntTest/build.xml
Project base dir set to: /scratch/mick/AntTest
Build sequence for target `printhelp' is [printhelp]
Complete build sequence is [printhelp]
printhelp:
[echo] Usage: ant -Dparameter=blah
[exec] Myos = SunOS
[exec] /bin/sh -c "echo `gnome-config --cflags` -o somefile.o
somefile.c"
[exec] -o somefile.o somefile.c
BUILD SUCCESSFUL
Total time: 2 seconds
Notice that the part contained within the backticks has dissappeared.
I'll poke around and see if I've missed something obvious (from my
experience of shells there is usually a 20 line hack to get around these
problems :)
The other option would be to create a task which evaluated the output of
*-config and created a set of properties from it. Hmm..
thanks,
mick
Stefan Bodewig wrote:
> Michael Twomey <[EMAIL PROTECTED]> wrote:
>
>
>>Usually these are invoked using backticks from the compiler command
>>line (e.g. 'gcc `gnome-config --cflags` -o somefile.o somefile.c')
>>but this never seemed to work for me in Ant when I tried passing
>>them as parameters.
>>
>
> It is the shell that is expanding the backticks magic, doing something
> like
>
> <exec executable="/bin/sh">
> <arg value="-c" />
> <arg value="gcc `gnome-config --cflags` -o somefile.o somefile.c" />
> </exec>
>
> should work (untested).
>
> Stefan
>
--
Michael Twomey
These opinions are my own and do not represent Sun unless otherwise stated.
Sun Microsystems, Dublin, 8199164, x19164
"Fly my little Makefiles! Fly!"