summaryrefslogtreecommitdiff
path: root/rootfs/Makefile
blob: c85132f183603f2901a1e2ab337cef66897edbe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fsmgr := $(shell command -v fsmgr)

ifeq ($(fsmgr),)
$(error "no fsmgr")
endif

sudo := $(shell [ "$$(id -u)" = 0 ] || echo sudo)

.DEFAULT_GOAL = all

.PHONY: all clean cleaner
all: $(addprefix _filesystem/samizdat., seed.btrfs patch.btrfs)

_build/%: _build
_filesystem/%: _filesystem

_build _filesystem:
	$(sudo) btrfs subvolume create $@

clean:
	btrfs subvolume delete _build
cleaner: clean
	-$(sudo) btrfs subvolume delete _filesystem

_build/%.patch.btrfs: %.seed.btrfs

_build/%.seed.btrfs: %.btrfs

_filesystem/%.btrfs: _build/%.btrfs

%.btrfs:
	$(sudo) $(fsmgr) build $@