Make says test is current. just still runs
Bare just runs the first recipe. Make often skips a target that matches a file.
Type just with no recipe and the first one runs as a command. Make sees a file with the same name and calls it up to date. To put recipes and deps on one page, open sitdraw.
The stall is not the syntax. It is Make treating the recipe name as an output file.
One command, two outcomes
Make looks at files
If test already exists, and the recipe is named test with no prerequisites, make test prints make: `test' is up to date. and exits.
just runs commands
The manual: just is a command runner. Every recipe is phony. Bare just uses [default], else the first recipe in the file.
Which recipe bare just runs
| Form | Bare just | Versus Make |
|---|---|---|
| First recipe in the file | Runs if no [default] | Make runs the first target, still checks the file |
| [default] | Sets the default recipe | Make has no such attribute |
| set default-list := true | Lists recipes, from 1.52.0 | Make has no equivalent switch |
| .PHONY | Not required | Make needs an explicit phony list |
One first recipe that actually runs
- 01Install just
Manual: a package manager, a pre-built binary, or
cargo install just. Linux, macOS, and BSD need a workingsh. - 02Write a justfile at the project root
Search goes upward, case-insensitive, including
.justfile. Put the usual recipe first, or mark it[default]. - 03Run just --list first
Confirm the name. Do not expect a Make target named
testto run every time if a file called test already exists. - 04Run bare just
It should execute the first recipe (or [default]). A leading
@hides the command echo. A failing command stops the recipe.
# justfile — first recipe is the default
test:
echo 'this always runs'
# Make equivalent that often does not run:
# test:
# ./test
# $ make test
# make: `test' is up to date.
just --list
justjust runs a command. Make asks whether that file is already there.
To keep recipe deps on one page, read the guide, then open a space from the start of the page.
Why does make test run nothing?
A file named test already exists and the recipe has no prerequisites. Make treats the target as current. just does not skip recipes on file timestamps.
Bare just ran the wrong recipe?
Without [default], it runs the first recipe in the file. Move the usual one to the top, or add [default]. To list instead of run, set default-list := true.
Bare just fails on Windows?
Default recipes use sh. Put Git for Windows, GitHub Desktop, or Cygwin sh on PATH. Or set shell in the justfile, for example set shell := ["powershell.exe", "-c"].
Name the recipe that will run
The default name in just --list is the command bare just executes. Do not read Make's up to date as tests having passed.