When to use make
Use make to execute recipes described by a trusted makefile. Targets can perform arbitrary actions, so inspect the project instructions and recipes before invoking a build on a server with valuable data or credentials.
Syntax
make [PARAMETERS] [TARGET...]Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
Run a standard trusted project target
makeThe default target is selected, which depends on the project's makefile.
Show build plan
make -n buildRecipes for the requested target are previewed. This is not a security sandbox: processing the makefile itself can execute commands.
Limit parallel build
make -j 2 buildUp to two recipe jobs can run concurrently when the dependency graph permits.
Notes and limitations
- Makefiles contain executable commands. Only run make in a trusted project.
- -n is not a sandbox: expansions while reading a Makefile and some recursive make calls can still execute actions.
Common questions and troubleshooting
Does make -n guarantee no code executes?
No. Processing a makefile and invoking recursive builds can still execute commands. Review untrusted makefiles instead of relying on dry-run mode as isolation.
Why does make report nothing to be done?
Targets may already be up to date according to dependencies and timestamps. Check the intended target and makefile before forcing a rebuild.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man make.