Question

I remember the general gist of writing Makefiles, but, due to CMake, autotools and other such Makefile generators, I've forgotten so many details that, if you were to ask me to write a makefile from scratch for a complex project, well, it would take me a couple of hours at least.

There must be many opinions out there, I'm looking for the most informative answer. Considering ninja (Makefiles not intended to be hand-written) and all the automatic generators, does it make any sense to arbitrarily brush up on Makefile syntax, aside from legacy code maintenance?

Was it helpful?

Solution

There's a lot of use in being able to "Manually Build" a project these days.

Whether that's through the use of a makefile, a shell script or a good old fashioned MsDos based batch file, it really doesn't matter.

There's not just legacy code maintenance as you point out, what about emergency patches and bug fixes to get systems back up and running.

Over the years, I've done a lot of work as a field engineer, and I've lost count of the amount of times I've been stuck in a data center with nothing more than an SSH terminal on the Laptop I have plugged in to some wacky & wonderful custom server system.

You don't always have the luxury of your usual tools, especially when your working on custom projects that are currently undergoing integration testing.

For that reason and that reason alone, it's always a good idea to be able to work using the barest of development environments, and if that means a copy of GCC, Make and Vim running off an 8gb bootable key chain containing a very basic *nix distro then it's worthwhile keeping the practice up.

OTHER TIPS

As a software developer, you should be familiar with the toolchain used by whatever project you are on. You need not be an expert in everything because your team should have one developer to own that process and be intimately familiar with all of the details, but you should be able to look at any build script and understand what it does.

With Makefiles specifically, you are more likely to be using a tool such as Automake to generate them anyway. So there is not much use in manually writing Makefiles, but you should be able to read them in case something does not work right.

Even if you did manually change a Makefile, next time you generate it your changes will go poof so why bother? Focus your efforts on updating the upstream configurations used to generate the Makefile to begin with.

Licensed under: CC-BY-SA with attribution
scroll top