I recently started a new C++ project. As it's fairly small and has few dependencies, I made a very conscious choice to just write a shell script to handle compilation. Yes, a Makefile would be "better", but it also adds a lot of complexity my project doesn't need, when I can have essentially a one-line build command. Still, my code has suddenly discovered the need for a second target, and I'll probably migrate to Makefiles- it's easier to add complexity when I need it.
Kai's organization transitioned from the small shell-scripts approach to builds to using Makefiles about a year ago. Kai wasn't involved in that initial process, but has since needed to make some modifications to the Makefiles. In this case, there's a separate Makefile for each one of their hundreds of microservices.
Each one of those files, near the top, has this:
# Please note two empty lines, do not change
define newline
endef
The first time Kai encountered this, a CTRL+F showed that the newline
define was never used. The second time, newline
was still unused. Eventually, Kai tracked back to one of the first Makefiles, and found a case where it was actually used. Twice.
It was easy to understand what happened: someone was writing a new Makefile, and looked at an older one for an example, and probably copy/pasted a lot of it. They saw a comment "do not change", and took this to mean that they needed to include this for reasons they didn't understand. And now, every Makefile has this do-nothing define for no real reason.
Kay writes:
Since finding out about this, I kept wondering what would happen if I started adding ASCII cows into those files with the comment: "Please note this cow, do not change"
_____________________________________
< Please note this cow, do not change >
-------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
This post originally appeared on The Daily WTF.