ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Hauser" <>
Subject RE: ant problem under cygwin and questions from a wanna-be Makefile convert
Date Mon, 21 Oct 2002 16:08:35 GMT
> -----Original Message-----
> From: Diane Holt []
> Sent: Donnerstag, 17. Oktober 2002 07:13
> To: Ant Users List;
> Subject: RE: ant problem under cygwin and questions from a wanna-be
> Makefile convert
> > > i) if there is a *.??.m4 file, run m4 on that file and create the
> > > corresponding *.??.html output file unless it exists already
> Yeah, didn't know 'm4' didn't let you specify an output file -- guess it
> expects you to be piping the output somewhere.
Yes, it unfortunately expects piping, I reported this in
> Anyway, to avoid the batch
> script, you could use the ant-contrib <foreach> and <if> tasks instead --
> for example:
>   <taskdef resource="net/sf/antcontrib/"/>
>   <target name="doM4">
>     <foreach target="runm4" param="">
>       <fileset dir="${basedir}" includes="m4files/*.??.m4"/>
>     </foreach>
>   </target>
>   <target name="runm4">
>     <basename property="" file="${}" suffix=".m4"/>
>     <dirname property="m4.dir" file="${}"/>
>     <property name="m4.out" location="${m4.dir}/${}.html"/>
>     <uptodate property="html.isUpToDate"
>        targetfile="${m4.out}" srcfile="${}"/>
>     <if>
>       <isset property="html.isUpToDate"/>
>     <then>
>       <echo>${m4.out} is up-to-date.</echo>
>     </then>
>     <else>
>       <echo>Processing ${}.m4 ...</echo>
        <exec executable="m4" output="${m4.out}">
>         <arg value="-P"/>
          <arg value="${}.m4"/>
>       </exec>
>     </else>
>     </if>
>   </target>
> Note: You will need to be running 1.5.1 to get the bug-fixed <basename>.

Diane, thanks for not giving up - it works!.

1) I added the missing quote around "output"
2) I upgraded ant to 1.5.1
3) got it from
4) added <arg value="${}.m4"/>

With that approach, I also got rid of the delete batch file (just one line)
that drops the apply srcfile argument: however, there must be a more
efficient solution!   ;)

  <target name="depPageFile" description="if the {page file}.m4 is newer,
                                remove its *.??.html descendants" >
    <foreach target="runDelete" param="outFileName.arg">
      <fileset dir="." includes="*.??.html"/>

  <target name="runDelete">
    <basename property="base.del.in0" file="${outFileName.arg}"
    <basename property="" file="${outFileName.arg}"/>
        <!-- add one of these if statements for each language supported
             in a nested way-->
        <equals arg1="${base.del.in0}" arg2="${}"/>
        <basename property="base.del.in1" file="${outFileName.arg}"
             <equals arg1="${base.del.in1}" arg2="${}"/>
             <basename property="base.del.in2" file="${outFileName.arg}"
             <!-- add if statement for fr -->
             <property name="" value="${base.del.in1}"/>
        <property name="" value="${base.del.in0}"/>
    <uptodate property="html.isUpToDate"
        <isset property="html.isUpToDate"/>
        <!--echo>${outFileName.arg} is up-to-date wrt.
        <delete file="${outFileName.arg}" verbose="true"/>

it would be great if a list of {en, de, fr, ..} could be defined and then
some way to iterate through it.

Rgds Ralf

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message