make
10 commands
10 shown
Run a specific target
Execute the 'build' target in the current Makefile
make build
Dry run (print commands only)
Print what would be executed without running it
make -n deploy
Pass variables on command line
Override Makefile variables at call time
make IMAGE=myapp:v2 TAG=latest push
Run parallel jobs
Run up to 4 recipe lines in parallel
make -j4 test
List all targets (with help pattern)
Convention: annotate targets with ## comments for self-documenting Makefiles
grep -E '^[a-zA-Z_-]+:.*?##' Makefile | awk -F':.*##' '{printf "%-20s %s\n", $1, $2}'
Force rebuild ignoring timestamps
Unconditionally remake all targets (-B / --always-make)
make -B build
Specify Makefile path
Use a Makefile in a different directory or with a different name
make -f infra/Makefile plan
Phony targets declaration
Prevent make from confusing targets with files of the same name
.PHONY: build test deploy clean
Automatic variable $@
$@ expands to the current target name in a recipe
build:
docker build -t $(IMAGE) . && echo 'Built $@'
Include sub-makefiles
Split a large Makefile into modular includes
include mk/*.mk
no commands match