How to become more productive using Makefile

Subscribe to my newsletter and never miss my upcoming articles


You want to become more productive, automate your workflow, there are many tools to help you achieve your goal.

make gives you the flexibility to run and compile a program from source. In this guide, we will use it to automate our development workflow. Note: I will use Django as an example, but the technics are applicable to other technologies. In this guide, I will use Makefile to automate many things in Django like database migration, superuser, deployment, and more. At the end of the guide, you'll be more productive in your development. Before you continue, ensure that make is installed in your system.


In Order to use make we need two(2) things one(1) we need to install it in our system and finally we need to create a file called Makefile.

To install make in your system you can follow these links : OSX Windows

Basic examples

To explore make let's begin with this simple program, go to any directory, and create a Makefile. Note: Don't give it an extension.

$ mkdir test_make && cd test_make
$ touch Makefile

Open the file with your text editor and put this

        echo "Hello world"

run the file by typing make inside the directory test_make

$ make

What is the output? Here is what I get.

echo "Hello world"
Hello world

Django integration

If you're a Django developer, you know how tedious is to repeat again and again these commands :

python runserver
python makemigrations
python migrate

Let's automate them with make

Clone the example project here and follow the README guide.

git clone && cd consume-restfull-api-with-django

Run the application to ensure that everything is working fine.

python migrate
python runserver

Open your browser and go to http://localhost:8000.

Inside the project, folder created a file called Makefile and add these lines.

touch Makefile

The final file will look like this

SHELL := /bin/bash

    @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

    pipenv install

    pipenv shell

    python runserver

    python makemigrations

    python migrate

    python createsuperuser

    git push heroku master

    docker-compose build
    docker-compose up -d

    docker-compose down

you'll be more productive with these tips.


Become more productive and make things done is very important, in this guide you've learned how to automate your workflow by using make.

What do you think about this? Let us know in the comment section.

No Comments Yet