-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
41 lines (33 loc) · 950 Bytes
/
Makefile
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
.PHONY: all fill unload withdraw save
check_defined = \
$(foreach 1,$1,$(__check_defined))
__check_defined = \
$(if $(value $1),, \
$(error Expected $1$(if $(value 2), ($(strip $2)))))
all: silos
@git status
silos:
@mkdir silos
@touch silos/.silos
@git init .
@git add silos/.silos
@git commit silos -m "Initial commit"
fill: silos
$(call check_defined, what)
$(call check_defined, into)
@echo "Filling silo $(into) with $(what)..."
@mkdir -p silos/$(into)
mv -vi $(what) silos/$(into)
slurp: silos fill unload save
unload: silos
@echo "Unloading $(silo)..."
$(call check_defined, silo)
@cd silos && stow -S -v $(silo) -t $(HOME) && cd -
withdraw: silos
$(call check_defined, silo)
@echo "Withdrawing $(silo)..."
@cd silos && stow -D -v $(silo) -t $(HOME) && cd -
save: silos/$(silo)
$(call check_defined, silo)
@echo "Saving $(silo)..."
git add silos/$(silo) && git commit silos/$(silo) -m "Update $(silo)"