While i'm developing in C/C++ and Java, i simply make a compile.bat script that does everything, that's fine for me. Why should i use make and why should i use ant?
Suppose you have 1000 source files and change just one of them. With your .bat script you will have to recompile the lot, with make you recompile just the one that changed. This can save quite a bit (read hours on a big project) of time.
Even better, if you change one of your header files, make will re-compile only the source files that use that header.
These are the two main features that have meant make and its offspring are used for all serious software development with compiled languages.
For one thing, make and ant both keep track of which files have already been compiled, so it does not redo work if it isn't needed.
With a build file, you can automate more than just compiling your code; you can run unit tests, gather metrics, package build artifacts for deployment, and more.
An advantage, of sorts, of Ant is that it inspired tools for other platforms - NAnt for .NET, Phing for PHP. They do the same things, and work in the same way.
As long as you develop for yourself under Windows: suit yourself.
But if you start to develop with others Ant and Make are a standard to describe how your App is built.
There may be several reasons: - because you are not the only one in the project - because somebody will have to care about the build script when you left - because a compile.bat script is not platform independent - because the policy of the project defines the build technology, e.g. for the entire enterprise
I recently read a funny article about build tools. For you only the first part may be of any interest (before the maven bashing starts)
You gain some platform-neutrality (how can I run your batch-script on my linux-box). But more important: build-tools have support for dependency-resolution. Scripts lack this and have to build it on their own.
Say you have targets A, B and C. B and C both depend on A. In an script they call the subroutine A. If you now create a new target D, that depends on B and C, than you will execute A twice. Build-tools recognize this and execute A only once.
Because this situation is typical for task involving compiling, building a distribution, testing, building documentation etc. build-tools are useful for software-development.
It would be possible to use a .bat file -- or bash or another flavor of shell script -- to do everything Ant can do, I believe. But it's far easier to do many things in Ant...
- create/move/delete files and directories
- apply filter tokens
- run unit tests
- package a jar, zip, or war properly
Many projects need to do these things, in addition to compiling, when they build.
Also Ant is platform-independent, so you can collaborate with those who use other operating systems.
But why stop at Ant? Apache Maven offers even more compelling features.
Make and Ant really come into their own when used with automated build systems or continuous integration.
The requirements for production builds, test builds and development builds are often different, and on a multi-person team, different developers set up their development environments in different ways.
Having a definitive build process solves the "Works on My Machine" (WOMM) problems that arise whenever the application needs to be built on a different machine from the one that it was developed on. It is the ultimate arbiter when one developer checks in code that doesn't work on another developer's machine. If the build process doesn't produce working software, then the first developer's check-in was broken. If it does produce working software then the second developer's development environment is broken - unless proven otherwise.