make(1): the most successful ArtificialIntelligence project ever.
Q: If God had not given us Makefiles, it would have been necessary to invent them.
A: I guess that is what DNA is.
Make is a program crafted by StuFeldman which controls the generation of executables and other non-source files of a program from the program's source files.
It first appeared in Version 7 Unix from AT&T BellLabs in 1979, and has since been revised and rewritten many times (see below for a list of implementations) to add features such as including information from other places in makefiles.
Make can be used to build and install programs. Make builds your program from an instruction file called the makefile. The makefile lists each of the non-source files and provides instructions on how to create it from other files and commands. In turn, those files are listed, with their production instructions, and so on, and so on, all the way back to the source code.
More generally, make uses rules to determine how to achieve goals (over a limited domain). It has been described (HaHaOnlySerious) as the most successful and widely used ArtificialIntelligence program around - although most AI experts would consider make's domain and set of possible strategies to be too limited to qualify it as anything more than a toy ArtificialIntelligence implementation by today's standards.
Books and Tutorials
The fantastically thin O'Reilly book: ManagingProjectsWithMake
A good tutorial is at http://www.eng.hawaii.edu/Tutor/Make/index.html
Make Implementations:
Note: ApacheAnt is nothing like make, apart from that it is also used to build software. It has a different (far inferior -- dare I say it, incorrect -- domain model).
Testimonials and Comments
I have found make to be the most powerful tool in my arsenal. Make, and cron are my allies. Make isn't just for programs, it is for data flow, UnitTests, web pages, database queries, and more. I find that the script that make executes for me is ALWAYS (Shout for joy) better than one I could write myself. -- ChrisGarrod
I have a small Makefile for my Objective Caml programs, and another one for my C++ programs. I copy them around wherever I go; I only have to edit the list of source files, the rest happens automatically. Once you have the initial Makefile which does what you want, using make is really a joy; however, writing that first Makefile can be a bit painful if you have no prior experience with make. One tip: make has SyntacticallySignificantWhitespace be sure you begin indented lines with tabs rather than spaces! -- StephanHouben
The easiest way to take advantage of multiple processors in your script-driven program is to write it as a makefile and use the -j option to make. -- PanuKalliokoski
Teach your computer well, and it will make things for you. -- anon
Personally, I'm kind of in two minds about makefiles. Personally, I sat down and learned how to write the things properly. Hence I only have one, it doesn't recurse and by default it does probably what I want.
Everyone else's attitude to makefiles scares me. They regard make as among the hardest languages to develop in. Here (this is a fairly major bank) the makefiles were cobbled together from some sort of working ones written by some now departed contractors... and no-one really wants to touch them so they've grown cruft... this is pretty much normal as far as I can tell. Working makefiles are rarer than working C++ code... --KatieLucas
Hmm, let me claim not to be part of "everyone". I've had the pleasure of working on makefiles to do quite complicated builds, working with (other) smart, motivated, developers. Developers, moreover, that give a damn. And we produced files that were damn near works of art (if I say so myself): well factored, easy to understand, easy to change. On that self-same project, though, I also had to attempt to debug a makefile provided by one of our suppliers that was >20K of recursive spaghetti. It seems as if word has got around that makefiles are hard to write at all, and so very few developers even think to try to write them well. It's a shame, because a good makefile can be a very satisfying thing. I'll even go out on a limb and assert that good recursive makefiles can be even more satisfying. --KeithBraithwaite
In my experience, the reason that many programmers consider makefiles "hard" and that many terrible makefiles exist is a failure to grasp that makefiles are an example of DeclarativeProgramming. If you think of a makefile as like a script, and a rule as like a function, you're going to have problems. --HannesReich?
Makefile achieves self-awareness: http://web.archive.org/web/20011019113616/http://segfault.org/story.phtml?id=3ba7eadc-03cdf340 [archived site, since segfault.org is sadly no longer with us]
See also RecursiveMakeConsideredHarmful