Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, if I'm developing a front-end only website, I might have several CoffeeScript files, several Sass files, several HTML Files, and a few images.

The CoffeeScript files need to be compiled to JavaScript, the Sass files need to be compiled to CSS, and those new files need to be minified. The images need their metadata removed. All of the resulting files need to be moved to a new directory with its own structure.

None of this seems particularly complicated, but I've seen several people use makefiles for this.

Am I being too reluctant to learn how to use makefiles? What advantages could they offer over a simple bash script?

share|improve this question
up vote 4 down vote accepted

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).

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.