Just vs Make: Stop Using Makefile as Task Runner
GNU make is a build system. just is a command runner. Stop fighting tabs and .PHONY — use the right tool for the job.
Every developer has seen this: a Makefile stuffed with targets like test, lint, deploy, format — none of which build anything. Make was designed for compiling C code in 1976. Using it as a task runner is like using a spreadsheet as a word processor. It works, but you’re fighting the tool instead of using it.
Enter just — a modern command runner built for exactly this purpose.
1. The Core Problem: Make Is Not a Task Runner#
Make’s job is simple: given a target file and source files, rebuild the target if any source is newer. That’s it. The entire design revolves around file timestamps.
But developers don’t need file-based builds. They need:
make test— run testsmake lint— check code stylemake deploy— push to productionmake format— auto-format code
None of these produce files. So you end up with .PHONY declarations, awkward variable passing, and cryptic $@ symbols. Make wasn’t designed for this.
[!TIP] If your Makefile has more
.PHONYtargets than real file targets, you’re using a build system as a task runner. Switch tojust.
2. What Is just?#
just is a command runner written in Rust by Casey Rodarmor (creator of ripgrep). It stores commands in a justfile and executes them on demand.
Think of it as a Makefile stripped of everything that makes Make complicated:
- No file timestamp tracking
- No
.PHONYdeclarations - No tab-vs-space holy wars
- No cryptic variable syntax
Installation#
# macOS
brew install just
# Ubuntu/Debian
sudo apt install just
# Cargo (any platform)
cargo install just
# Windows
winget install justbashA Minimal Justfile#
# Show available commands
default:
@just --list
# Run tests
test:
cargo test
# Lint code
lint:
cargo clippy -- -D warnings
# Format code
format:
cargo fmt
# Deploy to production
deploy ENV="staging":
@echo "Deploying to {{ENV}}..."
./scripts/deploy.sh {{ENV}}justRun commands with:
just test # run tests
just lint # lint code
just deploy prod # deploy to prod (ENV=prod)bashNo .PHONY. No tabs required. No cryptic syntax.
3. Head-to-Head Comparison#
| Feature | GNU Make | Just |
|---|---|---|
| Purpose | Build system (file-based) | Command runner |
| Indentation | Tabs required (spaces = crash) | Spaces or tabs |
.PHONY | Required for non-file targets | Not needed |
| Arguments | make target VAR=val | just target val |
| Command listing | grep hack or make -pn | just --list built-in |
| Cross-platform | Unix native; Windows needs WSL | Single binary, works everywhere |
| Recipe language | Shell only | Shell, Python, Node, etc. |
| Error messages | Cryptic | Clear and specific |
| .env support | None | Built-in |
| Parameter defaults | Awkward | First-class: ENV="dev" |
4. When to Use Make#
Make still wins in specific scenarios:
Incremental Builds#
If you’re compiling C/C++ code, Make’s file-timestamp tracking is exactly what you need. Rebuild only what changed.
main: main.c utils.c
gcc -o main main.c utils.cmakefileZero-Dependency Environments#
Make ships with virtually every Unix system. If you’re writing scripts for legacy servers, CI/CD pipelines, or open-source projects where you can’t control what contributors install — Make is the safe choice.
Existing Ecosystem#
The Linux kernel, autotools, CMake, and countless projects use Makefiles. If you’re contributing to these projects, you’ll work with Make regardless.
5. When to Use Just#
Just shines for daily development workflow:
Project Shortcuts#
Store all common commands in one place. New team members run just --list and see everything available.
# Development workflow
default:
@just --list
dev:
npm run dev
test:
npm test
lint:
npm run lint
typecheck:
npx tsc --noEmit
build:
npm run build
deploy ENV="staging":
./scripts/deploy.sh {{ENV}}justNo .PHONY Headaches#
In Make, if a folder named test exists, make test fails silently or runs the wrong target. You must declare .PHONY: test. Just doesn’t have this problem — it runs commands, not files.
Cross-Platform Teams#
Just works identically on Linux, macOS, and Windows. No WSL, no Cygwin, no path headaches. One binary, same behavior everywhere.
Polyglot Recipes#
Write recipes in any language with shebang syntax:
# Python recipe
validate:
#!/usr/bin/env python3
import json
with open("config.json") as f:
json.load(f)
print("Config valid!")
# Node.js recipe
report:
#!/usr/bin/env node
const fs = require("fs");
const pkg = JSON.parse(fs.readFileSync("package.json"));
console.log(`Project: ${pkg.name} v${pkg.version}`);justFirst-Class Parameters#
Pass arguments cleanly with defaults:
# Run migration
migrate ENV="dev" STEPS="1":
./manage.py migrate --environment={{ENV}} --steps={{STEPS}}
# Create new resource
resource NAME TYPE="service":
./scripts/create-resource.sh {{NAME}} {{TYPE}}justCompare to Make’s awkward make migrate ENV=dev STEPS=1.
6. Migration Guide#
Moving from Makefile to justfile is straightforward:
Before (Makefile)#
.PHONY: test lint format deploy
test:
npm test
lint:
npm run lint
format:
npx prettier --write .
deploy:
./scripts/deploy.shmakefileAfter (justfile)#
test:
npm test
lint:
npm run lint
format:
npx prettier --write .
deploy:
./scripts/deploy.shjustKey changes:
- Remove
.PHONYdeclarations - Replace tabs with spaces (or keep tabs — both work)
- Replace
$(VAR)with{{VAR}} - Add
defaultrecipe forjust --list
7. Hybrid Approach#
You don’t have to choose exclusively. Many projects use both:
- Makefile for actual build rules (compilation, bundling, asset generation)
- justfile for development tasks (test, lint, deploy, format)
This respects Make’s strengths while keeping your daily workflow clean.
# Use make for builds, just for everything else
build:
make -C build/
test:
cargo test
deploy:
./scripts/deploy.shjust