Convert make application to ant

Linux, Tips No Comments »

You have a make powered application, but you want to make it run through ant (for example if you want to integrate your application into maven) ? Well, it seems that this is easyer than i thought… you just need to add a build.xml in the application’s path, and add all your make rules as ant targets:

<?xml version='1.0'?>
<project name="MyProject" xmlns:ac="antlib:net.sf.antcontrib"
	default="help" basedir=".">
<!-- ****************** BUILD ********************* -->
<target name="build">
<exec executable="make" failonerror="true" logerror="true">
<arg value="--file=Makefile" />
<arg value="build" />
</exec>
</target>
.....
</project>

This assumes that your Makefile is located in the same folder as your new-created build.xml. And now voilla:

~/$ ant build
Buildfile: build.xml

build:
        [exec] building MyProject
.............
© Radu Baranga 2008
Entries RSS Comments RSS Log in