Tackling new languages and trying different things without people resisting seems impossible most of the time, but I think we have been able to do it because of Makefiles. It has helped us to establish common ground between every project whether its written on Ruby, Go, React, Java or Scala. Makefiles can help you get along with your coworkers and move your organization faster.
What is a Makefile?
Wikipedia says
If we go down the wikipedia rabbit hole you’ll find that Makefile stands alongside build automation tools like Rake, Gradle, Maven, etc.
The difference here is that we can use Makefile WITH those tools, we can use it as a common layer on top of whatever other tool, language or paradigm we choose.
How does a makefile works?
In theory you just type make and it all happens. Wait. But what do you mean it all happens?
In simple a way, we can say a Makefile has variables, targets, and each target can have dependencies.
Typing make actually unleashes a chained set of targets and their dependencies that perform a set of system commands for you.
Lets see an example of a Makefile that can help you build, tag and push the docker image of your project.
Adding this to any project with a Dockerfile and typing make will build and push your docker image.
Establishing common grounds
I had a teacher in college that once gave us an assignment project and told us
In the real world, that teacher is your co-worker filling in for you, your DevOps team or even your CI/CD pipeline, they will be grateful that there is a common way to address some of this stuff in all projects.
You want a standard way to compile, test, build and even deploy your applications, even if they are developed using different tools.
So even if you received an application in which you have never worked before you can type in make test and boom! things start to happen.
Makefiles in your CI/CD
Also you can standardize the way your pipelines work because every application will have more or less the same steps
- Test
- Build
- Container Build & Push
- Deploy
Using GitLab CI it would look something like this:
We used a scala base image for the test in the above example. So its not as generic as we would like … yet. There are more advanced features like inheriting rules from other Makefiles or even using CI templates which will help us get it there.
Try it out. It is definitely an awesome tool!




