Today I learned that you can use Makefiles to create simple task-runners.

Stuart Feldman invented Make in 1976 to automate build processes for C programs. But you can use it for other languages, too.

For example, Vladislav Supalov uses this Makefile for Docker commands:

  @echo "Usage: build or run"

  docker build -t test .

  docker run --rm -it test

Now run the file with your terminal:

> Usage: build or run

Build the Docker container via make build or run the container via make run.

Pitfall: Tabs vs Spaces

My editor replaces tabs with spaces.

Makefiles need tabs, otherwise you’ll get an error:

Makefile:5: *** missing separator.  Stop.

If you use Vim, you can setlocal noexpandtab to revert spaces to tabs.

Further Reading