You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by hiren patel <hi...@yahoo.com> on 2005/08/01 04:48:27 UTC

help with exec to compile c file

hi,
I am currently compiling using exec but it seems that ANT always compiles the .c file 
regardless of .c has changed or not. is there any way that ant checks for timestamps of source files and acts smart about building executable when we are using exec.
 
do you know how to modify code below to make the ant compile only when .c has chaged?
 
<?xml version="1.0"?>
<project name="mytask" default="gcc1" basedir=".">
<target name="init"> 
  <property name="source" value="test.cpp"/> 
        <property name="source1" value="test1.cpp"/>
</target>
<target name="gcc" depends="init">
 <exec dir="." executable="gcc">
  <arg line="-o"/>
  <arg line="test"/>
  <arg line="${source}"/> 
 </exec>
</target>

<target name="gcc1" depends="gcc">
 <exec dir="." executable="gcc">
  <arg line="-o"/>
  <arg line="test1"/>
  <arg line="${source1}"/> 
 </exec>
</target>

</project>



		
---------------------------------
 Start your day with Yahoo! - make it your home page