XML for Makefiles?

XML hasn’t cured our ills or saved the world, but people keep using it for absurd purposes anyways.

I finally took a quick look at Apache Ant today to see what all the fuss is about. Apparently with some additional components you can actually get Ant to build C/C++ code.

However, compare this build.xml for Ant:


<?xml version="1.0"?>

<project name="Hello" default="hello" basedir=".">

<taskdef resource="cpptasks.tasks"/>

<taskdef resource="cpptasks.types"/>

<target name="hello">

<cc name="gcc" outfile="hello">

<fileset dir="." includes="hello.c"/>

<compilerarg value="-O2"/>

</cc>

</target>

</project>

with this Makefile for gmake:


hello: hello.c

gcc -O2 $< -o $@

I think I’ll stick with gmake for now.

4 thoughts on “XML for Makefiles?

  1. Sam

    Ant is best used for Java applications. I find make to be ugly and a pain for Java. Ant has some nifty stuff for creating web applications in Java.

    I tried the cpp tasks for Ant for doing C++ builds and it *is* ugly and didn’t work. For that I think that gmake or bjam/jam is best.

  2. Alec Noronha

    If your project were predominantly in Java but needed a bit of C code thru the Java Native Interface (which would require compiling of C programs) then you would probably prefer the ant task over a makefile.

  3. Dejan Lekic

    I completely agree on this. However I look at Ant not as competition to MAKE, but as competition to GNU Autotools where it shines. I also agree with note about XML. People tend to put XML into absurd things. Per example using XML for any kind of database is IMHO absurd…

Comments are closed.