summaryrefslogtreecommitdiff
path: root/Makefile
blob: e6dd64198c42ff0ad592bba32b85aa72c447bf85 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.POSIX:

DEST ?= $(HOME)
DEST := $(abspath $(DEST))
LN = ln -vs

#---

all: help

## Display this message
help: printhelp

### TEMPLATES

## Install base configurations for any machine
base: bash lf nvim scripts tmux wget

## Install configurations for any desktop
desktop-base: base mpd ncmpcpp user-dirs xdg-desktop-portal

## Install configurations for a Sway desktop
desktop-sway: Xresources desktop-base fontconfig foot fuzzel kanshi lf mako nsxiv

### CONFIGURATIONS

##:
Xresources: $(DEST)/.config/Xresources
bash: $(DEST)/.bash_profile $(DEST)/.bashrc
fontconfig: $(DEST)/.config/fontconfig
foot: $(DEST)/.config/foot
fuzzel: $(DEST)/.config/fuzzel
kanshi: $(DEST)/.config/kanshi
lf: $(DEST)/.config/lf
mako: $(DEST)/.config/mako
mpd: $(DEST)/.config/mpd
ncmpcpp: $(DEST)/.config/ncmpcpp
nsxiv: $(DEST)/.config/nsxiv
nvim: $(DEST)/.config/nvim
scripts: $(DEST)/.local/bin $(DEST)/.config/fzy-bookmark $(DEST)/.config/fzy-tmux-project
sway: $(DEST)/.config/sway
tmux: $(DEST)/.config/tmux
user-dirs: $(DEST)/.config/user-dirs.dirs
wget: $(DEST)/.config/wget
xdg-desktop-portal: $(DEST)/.config/xdg-desktop-portal

#---

$(DEST)/%:
	$(LN) `realpath --relative-to=$(dir $@) $(subst $(DEST)/,,$@)` $@

printhelp:
	@awk ' \
		/^### / \
		{ printf "%s:\n", substr($$0, 5); next } \
		/^##:/ \
		{ c=" "; next } \
		/^$$/ \
		{ c=0; next } \
		/^## / \
		{ if (c) { print c }; c=substr($$0, 4); next } \
		c && /(^[[:alpha:]][[:alnum:]_-]+: .*$$)/ \
		{ printf "%s", $$1; if (c == " ") { $$1=""; printf "%s", gensub("[$$].DEST./", "", "g", substr($$0, 2)) } else { printf "%s", c }; printf "\n" } \
		' $(MAKEFILE_LIST) | column -ts:

.PHONY: all help printhelp