The Secrets of Make – Via Joe Mou

I had coffee chat at RC scheduled a coffee with  Joe. We were talking about our respective projects and he said that he was making a dev ops tool combining aspects of ansible and terraform but inspired by Make!

Whaaaa????

I have had a troubled relationship with Make.  I never took the time to learn all the syntax so it always seemed very convoluted.  And autoconf! what is up with that?Platform specific dependencies that you dont want to include in your makefile, as it turns out.

The idea that Make would be the inspiration for anything was shocking to me.   I asked Joe to walk me through the beauties of Make, and then he graciously took about 30 min to review the secrets of Make and how he uses Make (very extensively in turns out) in his workflow.

The Make dependency graph: This is most important qualities of Make for Joe.  If we have a bash script for example, we just have a bunch of lines that are executed. But in make the lines (or labels) are interpreted as nodes on a dependency graph, which each node being rebuilt when the target is not up to date.   There is also a good description with a visual from  this course at Princeton.

Make Rules:  Rules specify different parts of the dependency graph. One of the reason Joe uses Make instead of a bash is that you can easily separate the logic with different rules (and targets). This is useful for testing parts of your bash script or just for running separate commands that belong in the same file.  This alone is a reason argument for me to move over some of my scripts from bash to Make.

Joe also illustrated the use of Make for file processing using Make syntax and wildcarding, e.g., converting all the files in a directory from aif to mov via ffmpeg. This is something I have been doing an awful lot of since I have started playing with tidalcycles.

But still the dependency graph is the reason why Joe likes make.  Why is a dependency graph important?  Well, because its about flow. Its about how all the pieces of a system work together. In a Makefile this is what you are building.   It is an elegant way to glue all the pieces together. You can specify mock or dummy dependencies while you are building this out, so you can really outline how all the pieces of your system work together.

Terraform, the workflow automation tool of the moment, has  a dependency graph as well.  So Make is not the only workflow automation tool to implement this, but the terraform notion of providers gives terraform a particular POV. Terraform is for infrastructure specifically.  Having something like providers, acknowledges that details behind different infrastructure providers that require some sort of custom code that is best abstracted away from the dependency graph.  But including shell commands or scripts in terraform is not elegant and I think that Joe is definitely on to something.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.