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