←back to thread

Be Aware of the Makefile Effect

(blog.yossarian.net)
431 points thunderbong | 5 comments | | HN request time: 0.366s | source
1. donatj ◴[] No.42663834[source]
If I had a nickel for every time I have seen a Makefile straight up copied from other projects and modified to "work" while leaving completely unrelated unnecessary build steps and targets in place.

It's a major pet peeve of mine.

replies(1): >>42663962 #
2. bboygravity ◴[] No.42663962[source]
How do you know what is and isn't related if nothing is documented?

Trial and error?

Well have fun with that :p

replies(3): >>42664164 #>>42665315 #>>42667060 #
3. donatj ◴[] No.42664164[source]
Exactly. Bonus points if the person who started the project moved on and you have to be the one to build and maintain it.
4. rmgk ◴[] No.42665315[source]
You find the first part in your stack that is documented (e.g., make is documented, even if your makefile is not) and use that documentation to understand the undocumented part. You then write down your findings for the next person.

If you don’t have enough time, write down whatever pieces you understood, and write down what parts “seem to work, but you don’t understand“ to help make progress towards better documentation.

If you put the documentation as comments into the file, this can make copy&pasting working examples into a reasonably solid process.

5. marcosdumay ◴[] No.42667060[source]
Hum...

You know, a makefile is documentation. That's why you should probably never copy one (except for a single line here or there). There's space for commenting a few stuff, but your target names and variables should explain most of what is going there.

Anyway, the article and most people here seem to be talking about those autotools generated files. Or hand-built ones that look the same way. But either way, it's a bad solution caused by forcing a problem to be solved by a tool that wasn't aimed at solving it. We have some older languages without the concept of a "project" that need a lot of hand-holding for compiling, but despite make being intentionally created for that hand-holding, it's clearly not the best tool for that one task.