Makefile
A simple way to automate everyday project tasks with a single command. It allows you to run typical scripts (init
, test
, lint
, run
, etc.) without remembering long commands, and standardizes workflows for all developers.
What is it used for here?
!
- Makes work scripts short and convenient (
make test
instead ofuv run pytest
) - Unifies command execution for local work, CI/CD, and devcontainer
- Allows you to easily add your own automation scripts
How to run Makefile commands
- Your should be in the project root directory (where the
Makefile
is located).
!
-
Command format:
For example: -
To see all available commands (with short descriptions), use:
Or justmake
— by default, it runs help.
How to add your own command or section
!
- Open the Makefile.
-
Add a new target in the format:
- The
##
prefix indicates a description of command that will appear in the help output.
For example:
- The
-
Now you can run:
- Now you can see your command in the help:
- Open the Makefile.
-
Add a new section in the format:
- The
##@
prefix indicates a new section in the help output. - All commands that follow this line will be included in this section.
For example:
- The
-
Now you can run:
-
Now you can see your section in the help:
How does the help
command work?
- In this template, the
make help
command automatically parses the Makefile, looks for targets with comments, and displays a short help message. - Therefore, to have your command appear in help, always add a comment right after the target name and put it to correct section:
Useful
- All main template commands are described in Commands section.
- Makefile is OS-independent (works on Linux/macOS, on Windows via WSL or Git Bash).
- You can combine commands, for example:
For more details on configuration, see the GNU Make documentation