2

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?

  • Automake makefiles are makefiles, so you can't really write them without understanding the syntax and concepts of a makefile. – 5gon12eder May 11 '15 at 18:04
1

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.

| improve this answer | |
  • "Wacky & wonderful custom srrver system" - sounds like where I work! – Jerry Jeremiah May 12 '15 at 9:29
  • :-) Many people don't realize there's some strange gear that inhabits a lot of DC's ... in my case, I've worked a lot in GSM/Comms over the years. – shawty May 12 '15 at 12:15
4

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.

| improve this answer | |
  • 2
    +1, and I'd like to recommend Joel Spolsky's article "The Law of Leaky Abstractions". While he doesn't mention makefiles, his anecdotes about the importance of knowing the middle layers when their transparency is not 100% perfect applies here as well. – Idan Arye May 11 '15 at 16:17
  • Luckily, for me, reading them isn't a problem. Writing one from scratch -- that would be a little harder. Thanks, I'll accept in a day if nobody tops your answer. – Greg Kramida May 11 '15 at 20:08

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