Commake - v0.1.0

Commake (Common Makefile) is a standardised wrapper for your projects commands. Making it easy to jump between projects and get them into a running state.

Commake is a makefile for all software projects that creates a common and simple way to run a project locally. Therefore you don’t have to remember commands or read documents/ every time.


  1. Introduction
  2. Specification
  3. Usage
  4. Examples
  5. Customising Your Commake
  6. Contributing
  7. About
  8. Licence
  9. Previous Versions


I find occasionally I come back to projects and can no longer remember how to set them up so they run. On some projects, the commands have not been added to the README and passed between people. Other times on a personal project I forget to write them down.

Example - A node project:

If I come back to a Node project, this is my thought process:

  • Does this project use yarn or npm?
  • Have I got the correct version of node installed?
  • Do I need to do an install?
  • Do I need to set environment variables?
  • How do I serve this? npm run start, npm run serve, npm run dev?

All of this can be solved by using a common makefile across all your projects. Under the new world this would become the following:

  1. $ make init - Get the project requirements
  2. $ make install - Install any dependencies
  3. $ make run - Run the project


This is a version with nothing implemented:

# Commake (v0.1.0) -

.PHONY: all help init install build run lint test e2e plan deploy int versioncheck
all: lint test run #help Full check

	@echo "-- HELP --"
	@grep '#[h]elp' makefile

# Use this to check if they have the correct version
# To use update the if statement and the message.
	@if [ 0 -gt 0 ]; then
		echo "Wrong version of: <DEP>" &&
		exit 1;

init: #help Run through dependencies and check
	@echo Not Implemented

install: versioncheck #help Install packages
	@echo Not Implemented

build: #help Bulid the project files
	@echo Not Implemented

run: #help Run locally
	@echo Not Implemented

lint: #help Run linting
	@echo Not Implemented

test: #help Run the unit tests
	@echo Not Implemented

int: #help Run the int tests
	@echo Not Implemented

e2e: #help Run the e2e tests
	@echo Not Implemented

plan: #help Plan to run any infra changes
	@echo Not Implemented

deploy: #help Run any infra changes
	@echo Not Implemented

# Custom Commands - Put your custom commands below

The idea is not that these become really fancy, often they are just one line. See the examples section.



You will need make installed. The instructions for installing will depend on your operating system.

For example on Ubuntu: sudo apt install make


To run the help command use:

$ make help

Otherwise to run a command use make <target>. For example:

$ make run
$ make # To run the all target (lint, test, run)


Customising your Commake

This section contains a brief overview of make to help you get started. More in-depth content can be found here.

Note: All makefiles are tab seperated, they won’t work with spaces.


Variables from bash are accessed via a double dollar sign.

	echo $$myvar

Silencing commands

By default make prints out the command it’s about to run. Sometimes you may want to silence this. This is done by adding an at symbol before the command.

Since we run everything as a single line (see more). We only need this on the first line and that’s the only line that counts.

	@echo "Dont print me"


You might want to run other targets as prerequisites of your command. This is done by adding it after the targets colon.

You can see here that the install target requires versioncheck to be run beforehand.

install: versioncheck #help Install packages
	@echo Not Implemented

Make arguments

To pass arguments run make in the following style:

$ make run env=prod

You can then access this like:

run: #help Run locally
	@echo $(env)
	python $(env)

User interaction

This is useful when you want to pause and wait for the user to continue the script. Maybe waiting for them to run a command.

	@echo "Press ENTER to continue (ctrl+c to cancel)"
	@read line

If you want to do something more complex you can use a case statement.

	read -p "Do that? [y,n]" doit
	case $$doit in
		y|Y) echo yes ;;
		n|N) echo no ;;
		*) echo dont know ;;


Here are some default options that make our life a little easier.

  • .PHONY - This means that this isn’t actually a file and is just a command. Without this it will check if a file with the name of the target exists and if it does won’t run the command.
  • .ONESHELL - This is more natural for a beginners perspective. It stops each line being run as a different shell.


The makefile and this document are a work in progress. For example not much though has been put into the windows world. I would love to hear your suggestions. Either through PRs or Bugs here.

If you want to contribute a PR, you will need create a new version in the _posts directory of the current version.

On that new version set permalink: /commake and update the previous version. With the following:

6 sitemap: false
7 ---
9 # <span style="color:red">This is a old version: [newest version](/commake)</span>


This was created originally by Niall Bunting.


Creative Commons ― CC BY 3.0

Previous Versions