Search code examples
visual-studio-codemakefilevscode-tasks

Is use of `make` meaningful when using VS Code?


When using VS Code what you can do with make can be done with tasks.json as well and make is not preinstalled on Windows. If you can force your team which uses various OS to use VS Code, is there any reason to use make?


Solution

  • On the surface, you can use either Makefiles or tasks.json to execute various shell scripts. With the property dependsOn of tasks.json, you can do a topological sort of tasks that Makefile also does.

    There are still things that make does better than tasks.json:

    1. make can check timestamps of files to find which files are outdated and which tasks it doesn't need to execute. Maybe you can do that using various shell scripts in tasks.json, but using Makefiles would be far more convenient. For very big projects with a lot of source code, this is a very great feature since you can save a lot of time instead of re-building 100s of files you didn't need to.

    2. make contains an interface engine, supporting suffix rules and support for wildcards. I don't think tasks.json support that. You can probably use some extra shell scripts to achieve the same, but it won't be as neat as how make does it.

    3. Finally, Makefiles can be run in any system that has make, and therefore it is independent of VS Code.

    If you're working on a small/simple enough project, you can absolutely work on it without using make. For large projects, make is the sensible choice.

    In my college project, we are using Makefiles. We work on VS Code so we set the tasks.json scripts to just use make commands with the said Makefile. You can do that as well if you like.