For simple projects, what do makefiles offer over "plain" bash scripts?

Solution 1:

So, you're right that this in not a huge task,the advantages offered by make right now are

  • As Ignacio says make is parallel building aware. Use the -j flag.

  • If you have expressed you dependencies correctly make never rebuilds things that don't need it. Sure, you can get that in a bash script, but it means adding complexity to the script (and I'd have to read the man page to remember how) which make already knows about that.

  • You can define generic rules (suffix rules (old style) or pattern rules (preferred in GNU make)) that work on all files of type Bar need to be built from type Foo. Again, a loop will handle that in bash, but make already knows how to do that.

But the big advantage is: if the task gets more complicated you makefile grow slowly and simply, while your script may balloon unexpectedly.

If you can program (more or less at all) you can manage make (thought the language may be a little weird at first).

Solution 2:

Makefiles allow easy parallelization. Since make is (made) aware of dependencies, it can arrange jobs in such a manner that all the cores on the system are used as effectively as possible.