fsmgr := $(shell command -v fsmgr) ifeq ($(fsmgr),) $(error "no fsmgr") endif sudo := $(shell [ "$$(id -u)" = 0 ] || echo sudo) rootfs ?= samizdat.seed.btrfs patchfs ?= samizdat.patch.btrfs .DEFAULT_GOAL = all .PHONY: all rootfs patchfs clean all: $(rootfs) $(patchfs) _build _filesystem: $(sudo) btrfs subvolume create $@ clean = $(patchfs) $(rootfs) $(rootfs:%.seed.btrfs=%.btrfs) clean := $(clean) $(clean:%=%.tmp) clean: rm -f $(clean) rootfs: $(rootfs) patchfs: $(patchfs) %.patch.btrfs: %.seed.btrfs $(sudo) $(fsmgr) build $@ %.seed.btrfs: %.btrfs $(sudo) $(fsmgr) build $@ %.btrfs: $(sudo) $(fsmgr) build $@ $(patchfs): $(rootfs) $(patchfs) $(rootfs): $(sudo) REWRITE_SOURCES_LIST=y $(fsmgr) build $@