fsmgr := $(shell which fsmgr) ifeq ($(fsmgr),) $(error "no fsmgr") endif sudo := $(shell [ "$$(id -u)" = 0 ] || echo sudo) rootfs ?= samizdat.btrfs patchfs ?= samizdat.patch.btrfs .PHONY: all rootfs patchfs all: rootfs $(ifneq $(patchfs),,patchfs) rootfs $(rootfs): $(sudo) $(fsmgr) build $(rootfs) patchfs $(patchfs): $(sudo) REWRITE_SOURCES_LIST=y $(fsmgr) build $(patchfs)