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.

Write a justfilePut the usual one firstRun bare just

One command, two outcomes

1Recipe bare just runs
0.PHONY lines just needs
1.52.0default-list since

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

FormBare justVersus Make
First recipe in the fileRuns if no [default]Make runs the first target, still checks the file
[default]Sets the default recipeMake has no such attribute
set default-list := trueLists recipes, from 1.52.0Make has no equivalent switch
.PHONYNot requiredMake needs an explicit phony list

One first recipe that actually runs

  1. 01
    Install just

    Manual: a package manager, a pre-built binary, or cargo install just. Linux, macOS, and BSD need a working sh.

  2. 02
    Write a justfile at the project root

    Search goes upward, case-insensitive, including .justfile. Put the usual recipe first, or mark it [default].

  3. 03
    Run just --list first

    Confirm the name. Do not expect a Make target named test to run every time if a file called test already exists.

  4. 04
    Run 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
just

just 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.

Start the picture