Search code examples
xsltantmakefiledocbook

Convert Ant build file to Makefile


I have Ant build file which is used in Docbook. Now I am going to convert that Ant build file to a Makefile which uses Xsltproc processor. I am not particularly familiar with either Makefile or Ant. So please help me to convert it. Are there any resources which I should follow?

Here I want to, 1. copy folder structure and its content into another folder 2. configure java system properties 3. configure classpath

In ant script, it has code like this,

<copy todir="${output-dir}">
<fileset dir="${ant.file.dir}/template">
<include name="**/*"/>
</fileset>
</copy>

 <java classname="com.nexwave.nquindexer.IndexerMain" fork="true"> 
         <sysproperty key="htmlDir" value="${output-dir}/content"/>
         <sysproperty key="htmlExtension" value="${html.extension}"/>
           <classpath>
        <path refid="classpath"/>
        <pathelement location="${xercesImpl.jar}"/>         
        <pathelement location="/usr/share/xml-commons/lib/xml-apis.jar"/>    
      </classpath>
    </java>

I want to convert above 2 codes in make. Thank you..!!


Solution

  • Make and ANT are very different technologies. Your requirement would difficult to fufil for all but the simplest use cases.

    Here are some of the technical challenges:

    • ANT is not Make. On the surface it looks similar, but underneath works quite differently.
    • Surprisingly make is not very cross platform. Different flavours have subtle differences that could break an ANT to Makefile convertor.
    • ANT is designed to support Java programs, this means it has a rich syntax for managing nasty things like Java classpaths. Again difficult to translate.

    Update

    The following ANT java task

     <java classname="com.nexwave.nquindexer.IndexerMain" fork="true"> 
             <sysproperty key="htmlDir" value="${output-dir}/content"/>
             <sysproperty key="htmlExtension" value="${html.extension}"/>
               <classpath>
            <path refid="classpath"/>
            <pathelement location="${xercesImpl.jar}"/>         
            <pathelement location="/usr/share/xml-commons/lib/xml-apis.jar"/>    
          </classpath>
     </java>
    

    can be translated into the following unix java command-line.

    java \
       -DhtmlDir=$PUT_OUTPUT_DIR_HERE \
       -DhtmlExtension=$PUT_EXT_HERE \
       -cp $CLASSPATH:$PATH_TO_XERCES_JAR:/usr/share/xml-commons/lib/xml-apis.jar \
       com.nexwave.nquindexer.IndexerMain