summaryrefslogtreecommitdiff
path: root/rootfs/Makefile
blob: 3c7cf0a2810d64f67d3d54a369a1416a9ac19e52 (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
33
34
35
36
37
38
39
40
41
42
43
fsmgr := $(shell which fsmgr)

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

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

rootfs ?= samizdat.seed.btrfs
patchfs ?= samizdat.patch.btrfs
# gold ?= samizdat-gold.btrfs

.DEFAULT_GOAL = all

.PHONY: all rootfs patchfs clean
all: $(rootfs) $(patchfs)

clean = $(patchfs) $(rootfs) $(rootfs:%.seed.btrfs=%.btrfs)
clean := $(clean) $(clean:%=%.tmp)

clean:
	rm -f $(clean)

rootfs: $(rootfs)
patchfs: $(patchfs)
gold: $(gold)

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

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

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

$(gold): $(rootfs)
	$(sudo) $(fsmgr) build $@

$(patchfs): $(rootfs)

$(patchfs) $(rootfs):
	$(sudo) REWRITE_SOURCES_LIST=y $(fsmgr) build $@