DEV Community

Discussion on: How To Make A Makefile

Collapse
 
oscherler profile image
Olivier “Ölbaum” Scherler

I read about static pattern rules, and I think I’m seeing a difference, but I’ll have to make tests.

web.mit.edu/gnu/doc/html/make_4.ht...

Maybe you could have two lists of %.o files that you want to process with two different rules, so you prepend each rule with the corresponding list.

And also, as you said, for documentation/readability. I once made a big Makefile that was using ImageMagick to generate 12 derivatives from 3 intermediate formats for two types of source images. So that’s 18 rules that you only distinguish from the pattern. If I prepend it with the variable containing the list, it surely becomes more readable.

Thread Thread
 
deciduously profile image
Ben Lovy

Ah, cool - thanks for the link!

I've still got so much to learn about make. That's a complex use case...my biggest issue with makefiles is readability, so anything to help yourself out it worthwhile to me.