-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 1.45 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
TARGETS = home arch-virtualbox
ifeq ($(VERBOSE),1)
Q =
else
Q = @
endif
MKDIR = $(Q)mkdir --parents
STOW = $(Q)stow
SSTOW = $(Q)sudo stow
ECHO = @echo
INSTALL_TARGETS = $(TARGETS)
UNINSTALL_TARGETS = $(TARGETS:=-uninstall)
INSTALL_HOME = $(DESTDIR)/$(HOME)
INSTALL_ETC = $(DESTDIR)/etc
all: help
.PHONY: prepare
prepare:
$(MKDIR) $(INSTALL_HOME)/.config/aspell
$(MKDIR) $(INSTALL_HOME)/.config/distcc
$(MKDIR) $(INSTALL_HOME)/.config/git
$(MKDIR) $(INSTALL_HOME)/.config/gnupg
$(MKDIR) $(INSTALL_HOME)/.config/offlineimap
$(MKDIR) $(INSTALL_HOME)/.config/systemd/user
$(MKDIR) $(INSTALL_HOME)/.config/zsh
$(MKDIR) $(INSTALL_HOME)/.local/bin
$(MKDIR) $(INSTALL_HOME)/.local/share
$(MKDIR) $(INSTALL_HOME)/.ssh
headless: prepare
common: headless
common-uninstall: headless-uninstall
$(INSTALL_TARGETS): prepare common
$(UNINSTALL_TARGETS): common-uninstall
.PHONY: headless common $(INSTALL_TARGETS)
headless common $(INSTALL_TARGETS):
$(STOW) --target=$(INSTALL_HOME) --dir=$@ HOME
$(SSTOW) --target=$(INSTALL_ETC) --dir=$@ etc
.PHONY: headless-uninstall common-uninstall $(UNINSTALL_TARGETS)
headless-uninstall common-uninstall $(UNINSTALL_TARGETS):
$(STOW) --delete --target=$(INSTALL_HOME) --dir=$(@:-uninstall=) HOME
$(SSTOW) --delete --target=$(INSTALL_ETC) --dir=$(@:-uninstall=) etc
.PHONY: help
help:
$(ECHO) 'use make "target"'
$(ECHO) 'targets:'
$(ECHO) ' headless(-uninstall)'
$(ECHO) ' common(-uninstall)'
$(ECHO) ' home(-uninstall)'