Myth #1

Only useful for C, C++ and native software

Although it’s true that the C/C++ ecosystem was heavily influenced by the presence of make within the ecosystem, there’s much more that you can do with it. make can handle any kind of file, as long as it has a path and a timestamp.

The typical, boring example:

Creates a dependency tree of the commands that need to be run on each execution

If you run make edit , then main.o , kbd.o and command.o are compiled first, and then edit is built upon them

Sure. But you could also use it to transform, maybe something as simple as plain text files?

In this case, our (default) target is my-content.txt and it is built by simply concatenating the output of two dependent text files (created on the fly).

I am successfully using it in other scenarios like web development and mobile app development. But there’s no restriction on how it can be used.

Myth #2

It’s just another task runner, NPM scripts do the same job

That’s indeed not true. Yes, it kind of runs tasks (the commands of a rule) but not necessarily. Let’s stay on the example above with text files.

If we run make the first time, it will trigger the dependencies and then the main target. So yes, we run a bunch of tasks. But what happens if we run make again?

Nothing happens, but why?

It turns out that make is designed to keep track of the modification date of files. In this case, it detects that the modification time of dependency-1.txt and dependency-2.txt have not changed since my-content.txt was last built. Hence, my-content.txt does not need to be built.

What happens if we change the contents of a dependency?

Then, make is smart enough to figure out that only the first rule needs to be executed at this point.

This is not the same as what an npm script would do

script would do Achieving the same using a shell script would need much more code than a simple makefile

If each of these 3 rules took 30 seconds to run, you would be saving one minute for yourself on every execution

Myth #3

For web development that’s an overkill tool

If all you ever do is invoking webpack then, it is. In the rest of cases, it might not be at all. Put for example, a simple web site with styles, scripts and a static media gallery like this:

We want to:

Install the NPM dependencies

Minify the HTML code

Transpile Typescript, bundle and minify it

Fetch a remote JSON file with data to be imported by Typescript

Compile sass code into CSS and bundle it

Generate the sitemap

Optimize the images and videos

Etc…

You may be thinking of a simple script that would do the trick, run a few commands and the job is done, right? Well, you may get the site built, but at the expense of building everything every time.

Even if you just changed one character, the videos of your web site are going to be transcoded once and again. Even if you have the same styles, sass is going to launch every time. Even if you have a static site generator and the list of products hasn’t changed, your entire application will be rebuilt from scratch.