Commit | Line | Data |
---|---|---|
80cc9199 SK |
1 | MAKEFLAGS := --no-builtin-rules |
2 | ||
f908f2dc SK |
3 | DEPS := $(wildcard deps/*) |
4 | ||
0b63d662 | 5 | ifeq ($(shell uname),Darwin) |
ca0c92b8 | 6 | GREP := ggrep |
0b63d662 SK |
7 | SED := gsed |
8 | DIFF := $(shell gls -t1 /usr/local/Cellar/diffutils/*/bin/diff | head -1) | |
9 | else | |
ca0c92b8 | 10 | GREP := grep |
0b63d662 SK |
11 | SED := sed |
12 | DIFF := diff | |
13 | endif | |
14 | ||
2b497be2 | 15 | .PHONY: \ |
d03ce0c0 SK |
16 | default \ |
17 | clean \ | |
2b497be2 SK |
18 | $(DEPS) \ |
19 | deps \ | |
20 | home \ | |
ba898a09 | 21 | diff \ |
8132c0e4 | 22 | pull \ |
2b497be2 | 23 | mpdconf \ |
208d5ebf SK |
24 | pkgs_void \ |
25 | pkgs_void_update \ | |
2b497be2 SK |
26 | pkgs_brew_cask_install \ |
27 | pkgs_brew_install \ | |
dee031b5 | 28 | pkgs_cargo \ |
2b497be2 SK |
29 | pkgs_deb_install \ |
30 | pkgs_deb_purge \ | |
31 | pkgs_debian \ | |
32 | pkgs_mac \ | |
32cd449e SK |
33 | pkgs_pip_install \ |
34 | pkgs_pip_upgrade \ | |
2b497be2 SK |
35 | pkgs_snap_classic \ |
36 | pkgs_snap_strict | |
80cc9199 | 37 | |
75b7a956 SK |
38 | default: |
39 | @echo '================================================================================' | |
40 | @echo '| Default target disabled. Specify a concrete one.' | |
41 | @echo '================================================================================' | |
42 | @exit 1 | |
43 | ||
de7ac8e9 | 44 | home: mpdconf compiled |
cb7fdc22 | 45 | cp -Rp bin $(HOME)/ |
99e81ec2 SK |
46 | # Limit depth because directories are copied recursively: |
47 | find home -maxdepth 1 -print0 \ | |
ca0c92b8 | 48 | | $(GREP) -zv '^home$$' \ |
99e81ec2 | 49 | | xargs -0 -I% cp -Rp % ~ |
b46a64f4 | 50 | xdg-user-dirs-update |
b2efbb10 | 51 | |
9d953881 | 52 | mpdconf: |
b602a3d1 | 53 | mkdir -p ~/arc/aud |
72db580c SK |
54 | mkdir -p ~/var/lib/mpd/playlists |
55 | mkdir -p ~/var/log/mpd | |
56 | mkdir -p ~/var/run/mpd | |
57 | cp home/.mpdconf $(HOME)/ | |
9d953881 | 58 | |
de7ac8e9 SK |
59 | compiled: |
60 | mkdir -p bin | |
61 | cd src && make | |
62 | mv src/clockloop bin/ | |
63 | ||
bf20a98b | 64 | font_cache: |
72db580c | 65 | fc-cache -fv |
bf20a98b | 66 | |
208d5ebf SK |
67 | # |
68 | # Void Linux | |
69 | # | |
70 | ||
71 | pkgs_void: | |
72 | sudo xbps-install $(shell ./list pkgs-void.list) | |
73 | ||
74 | pkgs_void_update: | |
75 | xbps-query -m | awk -F - '{sub("-" $$NF "$$", ""); print}' | sort -u > pkgs-void.list | |
76 | patch pkgs-void.list pkgs-void.list.comments.patch | |
77 | ||
5bf7b45d SK |
78 | # |
79 | # Golang | |
80 | # | |
f30c615c | 81 | pkgs_golang: list pkgs-golang.list |
036e0e3c | 82 | go get -u $(shell ./list pkgs-golang.list) |
f30c615c | 83 | |
5bf7b45d SK |
84 | # |
85 | # Ubuntu | |
86 | # | |
31b0313b SK |
87 | pkgs_ubuntu: list pkgs-ubuntu.list |
88 | sudo apt install $(shell ./list pkgs-ubuntu.list) | |
89 | ||
d03ce0c0 SK |
90 | pkgs_ubuntu_debfiles: list pkgs-ubuntu-debfiles.list |
91 | ./install-debfiles pkgs-ubuntu-debfiles.list | |
92 | ||
5bf7b45d SK |
93 | # |
94 | # PIP | |
95 | # | |
32cd449e | 96 | pkgs_pip_install: |
427362ef | 97 | pip install --user $(shell ./list pkgs-pip.list) |
32cd449e SK |
98 | |
99 | pkgs_pip_upgrade: | |
427362ef | 100 | pip install --user --upgrade $(shell ./list pkgs-pip.list) |
5bf7b45d | 101 | |
dee031b5 SK |
102 | # |
103 | # Rust (cargo) | |
104 | # | |
105 | ||
106 | pkgs_cargo: list pkgs-cargo.list | |
107 | cargo install $(shell ./list pkgs-cargo.list) | |
108 | ||
5bf7b45d SK |
109 | # |
110 | # Homebrew/Mac | |
111 | # | |
112 | ||
70300ea4 SK |
113 | pkgs_mac: |
114 | $(MAKE) pkgs_brew_install | |
115 | $(MAKE) pkgs_brew_cask_install | |
116 | ||
cfe722ba SK |
117 | # TODO: Test pkgs_brew_tap when list contains multiple items |
118 | pkgs_brew_tap: list pkgs-brew-tap.list | |
119 | brew tap $(shell ./list pkgs-brew-tap.list) | |
120 | ||
70300ea4 SK |
121 | pkgs_brew_install: list pkgs-brew-install.list |
122 | brew install $(shell ./list pkgs-brew-install.list) | |
123 | ||
124 | pkgs_brew_cask_install: list pkgs-brew-cask-install.list | |
125 | brew cask install $(shell ./list pkgs-brew-cask-install.list) | |
126 | ||
5bf7b45d SK |
127 | # |
128 | # Debian | |
129 | # | |
649af0dd SK |
130 | pkgs_deb_install: list pkgs-deb-install.list |
131 | sudo apt install $(shell ./list pkgs-deb-install.list) | |
600d3b0b | 132 | |
649af0dd SK |
133 | pkgs_deb_purge: list pkgs-deb-purge.list |
134 | sudo apt purge $(shell ./list pkgs-deb-purge.list) | |
b59a4c3b | 135 | |
5bf7b45d SK |
136 | # |
137 | # Snap | |
138 | # | |
649af0dd SK |
139 | pkgs_snap_classic: list pkgs-snap-classic.list |
140 | @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-classic.list),pkg_snap_classic_$(p)) | |
6ce65841 | 141 | |
7ae05795 SK |
142 | pkgs_snap_strict: list pkgs-snap-strict.list |
143 | @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-strict.list),pkg_snap_strict_$(p)) | |
144 | ||
145 | # 'snap' command comes from 'snapd' deb pkg | |
6ce65841 SK |
146 | pkg_snap_classic_%: |
147 | sudo snap install --classic $* | |
7ae05795 SK |
148 | pkg_snap_strict_%: |
149 | sudo snap install $* | |
6ce65841 | 150 | |
f908f2dc SK |
151 | deps: $(DEPS) |
152 | ||
153 | define GEN_DEP_RULE | |
154 | $(1): | |
155 | cd $1 && make | |
156 | endef | |
157 | ||
158 | $(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d)))) | |
ab64e543 SK |
159 | |
160 | diff: | |
cca3111e | 161 | find home -type f -print0 \ |
0b63d662 | 162 | | $(SED) -z 's/^home\///g' \ |
b48e809e | 163 | | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=auto ~/% home/%' |
d03ce0c0 | 164 | |
8132c0e4 SK |
165 | pull: |
166 | find home -type f -print0 \ | |
0b63d662 SK |
167 | | $(SED) -z 's/^home\///g' \ |
168 | | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%' | |
8132c0e4 | 169 | |
d03ce0c0 SK |
170 | clean: |
171 | rm -rf ./debfiles | |
172 | cd src && make clean |