Replace Justfile with Makefile

Return back on using a Makefile for the build in order to remove extra
dependency.

Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
diff --git a/Justfile b/Justfile
deleted file mode 100644
index e07acea..0000000
--- a/Justfile
+++ /dev/null
@@ -1,114 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2024-2026 Jarkko Sakkinen <jarkko@kernel.org>
-
-set shell := ["bash", "-euo", "pipefail", "-c"]
-
-buildroot_version := "668b47bdab0bf4010a95187fed48b1489bace5c2"
-buildroot_hash    := "33084f85d2b499917c27c323d8d85a5caced247cb38640cbff0d330bc784e894"
-buildroot_site    := "https://github.com/buildroot/buildroot/archive" / (buildroot_version + ".tar.gz")
-
-buildroot_cache         := cache_directory() / "tpmdd" / "buildroot"
-buildroot_download_dir  := buildroot_cache / "download"
-buildroot_tarball       := buildroot_download_dir / "buildroot-" + buildroot_version + ".tar.gz"
-
-build_dir := "build"
-
-# List available recipes.
-default:
-  @just --list --unsorted
-
-# List available targets.
-list:
-  @cd "{{ justfile_directory() }}"/configs && ls *_defconfig | sed 's/_defconfig//'
-
-# Configure target.
-configure target: (dependencies target) (patch target)
-  @path_abs="{{ justfile_directory() }}/{{ build_dir }}/{{ target }}"; \
-  stamp="$(just _stamp {{ target }} configure)"; \
-  if [ -f "$stamp" ]; then exit 0; fi; \
-  mkdir -p "$path_abs" "$(dirname "$stamp")"; \
-  make -C "$path_abs/src/buildroot-{{ buildroot_version }}" O="$path_abs" \
-    BR2_EXTERNAL="{{ justfile_directory() }}" \
-    BR2_DL_DIR="{{ buildroot_download_dir }}" \
-    {{ target }}_defconfig; \
-  touch "$stamp"
-
-# Build target.
-build target: (configure target)
-  @path_abs="{{ justfile_directory() }}/{{ build_dir }}/{{ target }}"; \
-  make -C "$path_abs/src/buildroot-{{ buildroot_version }}" O="$path_abs" \
-    BR2_EXTERNAL="{{ justfile_directory() }}" \
-    BR2_DL_DIR="{{ buildroot_download_dir }}" \
-    -j$(nproc)
-
-# Burn the target disk image to a block device.
-burn target device: (build target)
-  @if [ ! -b "{{ device }}" ]; then \
-    echo "error: {{ device }} is not a block device" >&2; \
-    exit 1; \
-  fi
-  @sudo dd if="{{ justfile_directory() }}/{{ build_dir }}/{{ target }}/images/disk.img" \
-    of="{{ device }}" bs=1M status=progress oflag=sync
-
-# Delete build artifacts.
-clean:
-  rm -rf {{ build_dir }}
-
-[private]
-download target:
-  @stamp="$(just _stamp {{ target }} download)"; \
-  if [ -f "$stamp" ]; then exit 0; fi; \
-  mkdir -p "{{ buildroot_cache }}" "{{ buildroot_download_dir }}"; \
-  if [ ! -f "{{ buildroot_tarball }}" ]; then \
-    wget -q --show-progress -O "{{ buildroot_tarball }}.partial" "{{ buildroot_site }}"; \
-    mv "{{ buildroot_tarball }}.partial" "{{ buildroot_tarball }}"; \
-  fi; \
-  mkdir -p "$(dirname "$stamp")"; \
-  touch "$stamp"
-
-[private]
-verify target: (download target)
-  @stamp="$(just _stamp {{ target }} verify)"; \
-  if [ -f "$stamp" ]; then exit 0; fi; \
-  echo "{{ buildroot_hash }}  {{ buildroot_tarball }}" | sha256sum --status -c -; \
-  mkdir -p "$(dirname "$stamp")"; \
-  touch "$stamp"
-
-[private]
-unpack target: (verify target)
-  @path_abs="{{ justfile_directory() }}/{{ build_dir }}/{{ target }}"; \
-  src_dir="$path_abs/src/buildroot-{{ buildroot_version }}"; \
-  stamp="$(just _stamp {{ target }} unpack)"; \
-  if [ -f "$stamp" ]; then exit 0; fi; \
-  mkdir -p "$src_dir"; \
-  tar -xf "{{ buildroot_tarball }}" --strip-components=1 -C "$src_dir"; \
-  mkdir -p "$(dirname "$stamp")"; \
-  touch "$stamp"
-
-[private]
-patch target: (unpack target)
-  @path_abs="{{ justfile_directory() }}/{{ build_dir }}/{{ target }}"; \
-  src_dir="$path_abs/src/buildroot-{{ buildroot_version }}"; \
-  stamp="$(just _stamp {{ target }} patch)"; \
-  if [ -f "$stamp" ]; then exit 0; fi; \
-  patches_dir="{{ justfile_directory() }}/patches/buildroot"; \
-  if [ -d "$patches_dir" ]; then \
-    for p in "$patches_dir"/*.patch; do \
-      [ -f "$p" ] || continue; \
-      patch -d "$src_dir" -p1 -i "$p"; \
-    done; \
-  fi; \
-  mkdir -p "$(dirname "$stamp")"; \
-  touch "$stamp"
-
-[private]
-dependencies target:
-  @if [ ! -f "{{ justfile_directory() }}/configs/{{ target }}_defconfig" ]; then \
-    echo "error: missing configs/{{ target }}_defconfig" >&2; \
-    exit 1; \
-  fi
-
-# Stamp file path for a target stage.
-[private]
-_stamp target name:
-  @echo "{{ justfile_directory() / build_dir / target / "stamp" / name }}"
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..05b75d5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,109 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2024-2026 Jarkko Sakkinen <jarkko@kernel.org>
+
+# Build system
+SHELL := bash
+.ONESHELL:
+.SHELLFLAGS := -euo pipefail -c
+
+# Versions
+BUILDROOT_VERSION ?= 2026.05
+
+# URLs and hashes
+BUILDROOT_HASH ?= 9d2f3af10fcac763a61ff6e41894a033f9ecf9267ba13dd0912eedcd3be2b22a
+BUILDROOT_URL  ?= https://buildroot.org/downloads/buildroot-$(BUILDROOT_VERSION).tar.xz
+
+# Directories
+BUILD_DIR    ?= build
+BOARD_DIR    := $(abspath $(BUILD_DIR)/$(BOARD))
+STAMP_DIR    := $(BOARD_DIR)/stamp
+CACHE_DIR    := $(HOME)/.cache/tpmdd/buildroot
+DOWNLOAD_DIR := $(CACHE_DIR)/download
+
+# Stamps
+VERIFY_STAMP := $(STAMP_DIR)/$(BUILDROOT_VERSION)/verify
+UNPACK_STAMP := $(STAMP_DIR)/$(BUILDROOT_VERSION)/unpack
+PATCH_STAMP  := $(STAMP_DIR)/$(BUILDROOT_VERSION)/patch
+
+# Artifacts
+BUILDROOT_TARBALL := $(DOWNLOAD_DIR)/buildroot-$(BUILDROOT_VERSION).tar.xz
+
+# Buildroot invocation helper
+define buildroot
+  make -C "$(BOARD_DIR)/src/buildroot-$(BUILDROOT_VERSION)" O="$(BOARD_DIR)" \
+    BR2_EXTERNAL="$(CURDIR)" BR2_DL_DIR="$(DOWNLOAD_DIR)" \
+    $(1)
+endef
+
+ifneq ($(filter-out default help list clean download,$(MAKECMDGOALS)),)
+  ifndef BOARD
+    $(error BOARD is required, e.g.: make build BOARD=tpmdd_amd64_efi)
+  endif
+endif
+.PHONY: default help list download dependencies configure build burn clean
+
+default: help
+
+help: ## Show this help
+	@awk -F ':[^#]*## ?' '/^[a-z_-]+:[^#]*##/{printf "  make %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
+
+list: ## List available defconfigs
+	@cd configs && ls *_defconfig | sed 's/_defconfig//'
+
+$(BUILDROOT_TARBALL):
+	@mkdir -p "$(DOWNLOAD_DIR)"
+	wget -q --show-progress -O "$@.partial" "$(BUILDROOT_URL)"
+	mv "$@.partial" "$@"
+
+download: $(BUILDROOT_TARBALL) ## Prime the Buildroot download cache
+
+$(VERIFY_STAMP): $(BUILDROOT_TARBALL)
+	@echo "$(BUILDROOT_HASH)  $(BUILDROOT_TARBALL)" | sha256sum --status -c -
+	mkdir -p "$(dir $@)"
+	touch "$@"
+
+$(UNPACK_STAMP): $(VERIFY_STAMP)
+	@path_abs="$(BOARD_DIR)"
+	src_dir="$$path_abs/src/buildroot-$(BUILDROOT_VERSION)"
+	rm -rf "$$src_dir"
+	mkdir -p "$$src_dir"
+	tar -xf "$(BUILDROOT_TARBALL)" --strip-components=1 -C "$$src_dir"
+	mkdir -p "$(dir $@)"
+	touch "$@"
+
+$(PATCH_STAMP): $(UNPACK_STAMP)
+	@path_abs="$(BOARD_DIR)"
+	src_dir="$$path_abs/src/buildroot-$(BUILDROOT_VERSION)"
+	patches_dir="$(CURDIR)/patches/buildroot"
+	if [ -d "$$patches_dir" ]; then
+		for p in "$$patches_dir"/*.patch; do
+			[ -f "$$p" ] || continue
+			patch -d "$$src_dir" -p1 -i "$$p"
+		done
+	fi
+	mkdir -p "$(dir $@)"
+	touch "$@"
+
+dependencies:
+	@if [ ! -f "$(CURDIR)/configs/$(BOARD)_defconfig" ]; then
+		echo "error: missing configs/$(BOARD)_defconfig" >&2
+		exit 1
+	fi
+
+configure: dependencies $(PATCH_STAMP) ## Run <BOARD>_defconfig
+	@mkdir -p "$(BOARD_DIR)"
+	$(call buildroot,$(BOARD)_defconfig)
+
+build: configure ## Build <BOARD>
+	$(call buildroot,)
+
+burn: build ## Write <BOARD> disk image to DEVICE
+	@if [ ! -b "$(DEVICE)" ]; then
+		echo "error: $(DEVICE) is not a block device" >&2
+		exit 1
+	fi
+	sudo dd if="$(BOARD_DIR)/images/disk.img" \
+		of="$(DEVICE)" bs=1M status=progress oflag=sync
+
+clean: ## Remove build artifacts
+	rm -rf "$(CURDIR)/$(BUILD_DIR)"
diff --git a/README.md b/README.md
index 0615487..1029646 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@
 
 1.  **Configure the project** (only needed for the first build):
     ```
-    just prepare configs/tpmdd_amd64_defconfig
+    make configure BOARD=tpmdd_amd64_efi
     ```
 
 2.  **Build the image**:
     ```
-    just all
+    make build BOARD=tpmdd_amd64_efi
     ```
-    For any subsequent changes, you can simply re-run `just all`.
+    For any subsequent changes, you can simply re-run `make build BOARD=tpmdd_amd64_efi`.