Why You Need a Makefile in Your Project

Andrew Graham-Yooll
Mercadona Tech
Published in
4 min readJul 11, 2019

--

“Great things are done by a series of small things brought together.” — Vincent Van Gogh

At Mercadona Tech we are building a world-class grocery shopping experience. As with any large-scale project, we interact with numerous services, libraries, tooling, etc. on a daily basis. Meanwhile, we must continuously and reliably deliver the greatest value and experience possible to our jefes (customers at Mercadona).

Make and Makefiles are one of many tools we leverage at MercadonaTech to accomplish this feat. They have made a huge impact on how we sustain velocity and ensure day to day software development stays consistent and remains a joy.

After numerous iterations, our Makefiles came out of an evolution of need, relieving us from repeating the mundane. Filling in small gaps to how we evolved our organization, architecture, and tackling inevitable challenges we have encountered along the way.

Makefiles allow us to sustain that dopamine rush when developing a high impact product. They keep our stack easily reproducible in any environment, facilitate an efficient on-boarding process, and lower the barrier to deployment.

An example Makefile from one of our projects. https://gist.github.com/andrewgy8/05547ccacfecdf992f6244d39efa6d00#file-makefile

As you can see, our Makefile defines the execution of the mundane, but very important tasks for everyday work in a simple, easy to read and type commands.

Personally, I find myself daily running, make env-recreate and make test. I could not imagine manually writing all those commands out in a verbose manner.

Simple Deployments

We strive for a seamless CI/CD pipeline at MercadonaTech. And doing so, we try to reduce the amount of friction imposed to create releases. With that being said, we must get our deployments right every single time. One Makefile command from the project’s root by anyone on our team, make prepare-deploy, and they have created a deployment which is rolled out to our kubernetes cluster. It is a reproducible command that is successfully triggered multiple times per day. That is one step in our goal of complete CD.

Reproducibility

Have you ever wanted to reproduce locally a particular issue in production, but you never had the time to setup your local environment properly? We can do that in a matter of seconds. What you would find in staging, production, or in our CI pipeline is simple to run and debug locally with a simple Make command. This gives us the freedom of reacting to incidents in our services and solve issues quickly.

Quicker Onboarding

One of many great thing about new people joining the team is that they bring new ideas and perspectives. The last thing we want to do is stand in the way. Having a Makefile means less time spent setting up their environment and more time discovering our code base, making changes, and more time thinking about new ways of doing things. In addition, it makes for a good first impression to the newcomer. We can have them hit the ground running!

Comfortable Inter-Team Exchange

At MercadonaTech, you will never be on one team forever. We switch up the teams, allowing seamless transitions from our shop teams to our logistics teams, or vice versa. Having standard Makefile commands in each project allows predictability when making that transition to a new team easier. You know how to start up the project, tear it down, run it, test it, lint it, and create realistic data to play with locally. You end up feeling at home on any team.

Open Source Ownership Model

Much like our inter-team exchanges, we take seriously the principle that no team should block another team from delivering value. Therefore we employ the principle of an Open Source Ownership among our projects. Teams should contribute to other’s projects when they need something, instead of waiting for project owners to implement it for them. Makefiles, as you can guess, allow teams to clone, startup, and start developing in a foreign environment quickly.

Comfortable Inter-Disciplinary Exchange

You are frontend and want to pair with a backend developer to solve a particular issue together? No problem. Like moving from team to team, we can also move from discipline to discipline. It allows us to see how different disciplines solve problems, and we can expand our knowledge of our entire stack to the rest of the team. Just like with new team members, Makefiles allow the onboarding of a member from another discipline to be as friction-less as possible.

Extensive

Yes we know, Makefiles can get complicated. But if it’s complicated, then we are probably doing something wrong. All of our commands are <2 lines long. With these smaller commands, we can then compose larger commands for our particular use cases. And when something changes either architecturally or process-wise, we can easily make adjustments to our Makefiles.

Makefiles contribute to a simpler development life. To the point where we include one in every backend service that we have at MercadonaTech. They save us an incredible amount of time and energy. They allow fluid team structures. And they allow us to quickly answer questions about whats happening in our environments.

As a result, we have been able to explore new and exciting technologies that bring better results to our ever growing amount of jefes!

If you would like to try out our Makefiles, apply to one of our engineering positions found here!

--

--