All build tools began with Make

All build tools began with Make

(image taken from slashcrisis' photostream)

Today I'm just going to share a pet hate: poor target names in build files. Yes, that's scratching the surface: there's plenty of other things to get wrong in your build. But today's gripe is target names. Here's an anonymised example from a real project:

<?xml version="1.0" ?>
<project name="project" default="tests" basedir="..">

<target name="run-database-tests" description="Runs all database tests"
depends="foo-run-database-tests, bar-run-database-tests, baz-run-database-tests" />

<target name="produce-docs" description="Produces javadocs for the project">
<echo message="Building docs for ${common.dir}"/>
<run-javadoc dest="${common.dir}" source="${common.dir}/src/java/com/company/project/common/"/>
</target>

<target name="produce-diagrams" description="Produces diagrams for the project">
<run-springviz dest="${foo.dir}" config="${foo.dir}/config/WEB-INF"/>
<run-springviz dest="${bar.dir}" config="$baradmin.dir}/config/WEB-INF"/>
<run-springviz dest="${baz.dir}" config="${baz.dir}/config/WEB-INF"/>
</target>

</project>

What on earth would you do but run the database tests and produce the javadoc? Aren't the verbs (like run and produce) superfluous here?

What if instead of typing

ant produce-docs


You could type

ant db-tests docs

It all makes sense when you think that most build tools are evolved from make. If you replace the examples above with make instead of ant, it seems to work.

Make was written in 1977 by Stuart Feldman at Bell Labs. Just about every Unix distribution ever includes make (or a bastardized version, but that's another story). Microsoft implemented it. If you're interested in build tools, have a play with make: it's part of their heritage.

For me once I fool myself into thinking that the name of build tool is a verb, you don't feel the need to put a verb in every target.

Still, I doubt that Apache Ant would have flown with a name that was a tribute to make (Jake? Ache?). And what they have called NAnt? Don't go renaming your build tools on my account; but when you write a target, pretend you're building with Make.

DevOps New Zealand