

#Makefile vs runjs how to#
In fact, we’ve already written in detail about how to use make for development on AVR or ARM micros. For numerous decades, make has remained utterly ubiquitous, and for good reason: Makefiles are incredibly versatile and can be used for everything from web development to low level embedded systems. Make solves the problems I mentioned above – it tracks dependencies between sources and outputs, and runs complex compilation commands for you. Yet another product of the famous Bell Labs, make was written by in response to the frustration of a co-worker who wasted a morning debugging an executable that was accidentally not being updated with changes. They started to make automated software that could track compilation dependencies, track which bits of code were tweaked since the last build, and combine this knowledge to automatically optimise what gets compiled – ensuring your computer does the minimum amount of work possible.

People realised fairly early on that this sucked, and that we can do better. Also, you’re having to recompile every file every time, even though you might only have made a small change to one of them. Once you’ve built out your program a bit more, adding code from other files and libraries, these g++ commands are starting to get a bit long, as you’re having to link together a lot of different stuff. Let’s say you’ve written your C++ program, compiled it with g++ or clang++ or your compiler flavor of the week, and reveled in the magic of software. Should we still be using make in 2021? Jump into the fray in the comments. I want to hear what you use to build your software.

What do you do whilst your code’s compiling? Pull up Hackaday? Check Elon Musk’s net worth? Research the price of a faster PC? Or do you wonder what’s taking so long, and decide to switch out your build system?Ĭlamber aboard for some musings on Makefiles, monopolies, and the magic of Ninja.
