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 SK |
23 | mpdconf \ |
24 | pkgs_brew_cask_install \ | |
25 | pkgs_brew_install \ | |
dee031b5 | 26 | pkgs_cargo \ |
2b497be2 SK |
27 | pkgs_deb_install \ |
28 | pkgs_deb_purge \ | |
29 | pkgs_debian \ | |
30 | pkgs_mac \ | |
32cd449e SK |
31 | pkgs_pip_install \ |
32 | pkgs_pip_upgrade \ | |
2b497be2 SK |
33 | pkgs_snap_classic \ |
34 | pkgs_snap_strict | |
80cc9199 | 35 | |
75b7a956 SK |
36 | default: |
37 | @echo '================================================================================' | |
38 | @echo '| Default target disabled. Specify a concrete one.' | |
39 | @echo '================================================================================' | |
40 | @exit 1 | |
41 | ||
de7ac8e9 | 42 | home: mpdconf compiled |
cb7fdc22 | 43 | cp -Rp bin $(HOME)/ |
99e81ec2 SK |
44 | # Limit depth because directories are copied recursively: |
45 | find home -maxdepth 1 -print0 \ | |
ca0c92b8 | 46 | | $(GREP) -zv '^home$$' \ |
99e81ec2 | 47 | | xargs -0 -I% cp -Rp % ~ |
b2efbb10 | 48 | |
9d953881 | 49 | mpdconf: |
b602a3d1 | 50 | mkdir -p ~/arc/aud |
72db580c SK |
51 | mkdir -p ~/var/lib/mpd/playlists |
52 | mkdir -p ~/var/log/mpd | |
53 | mkdir -p ~/var/run/mpd | |
54 | cp home/.mpdconf $(HOME)/ | |
9d953881 | 55 | |
de7ac8e9 SK |
56 | compiled: |
57 | mkdir -p bin | |
58 | cd src && make | |
59 | mv src/clockloop bin/ | |
60 | ||
bf20a98b | 61 | font_cache: |
72db580c | 62 | fc-cache -fv |
bf20a98b | 63 | |
5bf7b45d SK |
64 | # |
65 | # Golang | |
66 | # | |
f30c615c | 67 | pkgs_golang: list pkgs-golang.list |
036e0e3c | 68 | go get -u $(shell ./list pkgs-golang.list) |
f30c615c | 69 | |
5bf7b45d SK |
70 | # |
71 | # Ubuntu | |
72 | # | |
31b0313b SK |
73 | pkgs_ubuntu: list pkgs-ubuntu.list |
74 | sudo apt install $(shell ./list pkgs-ubuntu.list) | |
75 | ||
d03ce0c0 SK |
76 | pkgs_ubuntu_debfiles: list pkgs-ubuntu-debfiles.list |
77 | ./install-debfiles pkgs-ubuntu-debfiles.list | |
78 | ||
5bf7b45d SK |
79 | # |
80 | # PIP | |
81 | # | |
32cd449e SK |
82 | pkgs_pip_install: |
83 | pip3 install --user $(shell ./list pkgs-pip.list) | |
84 | ||
85 | pkgs_pip_upgrade: | |
86 | pip3 install --user --upgrade $(shell ./list pkgs-pip.list) | |
5bf7b45d | 87 | |
dee031b5 SK |
88 | # |
89 | # Rust (cargo) | |
90 | # | |
91 | ||
92 | pkgs_cargo: list pkgs-cargo.list | |
93 | cargo install $(shell ./list pkgs-cargo.list) | |
94 | ||
5bf7b45d SK |
95 | # |
96 | # Homebrew/Mac | |
97 | # | |
98 | ||
70300ea4 SK |
99 | pkgs_mac: |
100 | $(MAKE) pkgs_brew_install | |
101 | $(MAKE) pkgs_brew_cask_install | |
102 | ||
cfe722ba SK |
103 | # TODO: Test pkgs_brew_tap when list contains multiple items |
104 | pkgs_brew_tap: list pkgs-brew-tap.list | |
105 | brew tap $(shell ./list pkgs-brew-tap.list) | |
106 | ||
70300ea4 SK |
107 | pkgs_brew_install: list pkgs-brew-install.list |
108 | brew install $(shell ./list pkgs-brew-install.list) | |
109 | ||
110 | pkgs_brew_cask_install: list pkgs-brew-cask-install.list | |
111 | brew cask install $(shell ./list pkgs-brew-cask-install.list) | |
112 | ||
5bf7b45d SK |
113 | # |
114 | # Debian | |
115 | # | |
649af0dd SK |
116 | pkgs_deb_install: list pkgs-deb-install.list |
117 | sudo apt install $(shell ./list pkgs-deb-install.list) | |
600d3b0b | 118 | |
649af0dd SK |
119 | pkgs_deb_purge: list pkgs-deb-purge.list |
120 | sudo apt purge $(shell ./list pkgs-deb-purge.list) | |
b59a4c3b | 121 | |
5bf7b45d SK |
122 | # |
123 | # Snap | |
124 | # | |
649af0dd SK |
125 | pkgs_snap_classic: list pkgs-snap-classic.list |
126 | @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-classic.list),pkg_snap_classic_$(p)) | |
6ce65841 | 127 | |
7ae05795 SK |
128 | pkgs_snap_strict: list pkgs-snap-strict.list |
129 | @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-strict.list),pkg_snap_strict_$(p)) | |
130 | ||
131 | # 'snap' command comes from 'snapd' deb pkg | |
6ce65841 SK |
132 | pkg_snap_classic_%: |
133 | sudo snap install --classic $* | |
7ae05795 SK |
134 | pkg_snap_strict_%: |
135 | sudo snap install $* | |
6ce65841 | 136 | |
f908f2dc SK |
137 | deps: $(DEPS) |
138 | ||
139 | define GEN_DEP_RULE | |
140 | $(1): | |
141 | cd $1 && make | |
142 | endef | |
143 | ||
144 | $(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d)))) | |
ab64e543 SK |
145 | |
146 | diff: | |
cca3111e | 147 | find home -type f -print0 \ |
0b63d662 SK |
148 | | $(SED) -z 's/^home\///g' \ |
149 | | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=always ~/% home/%' | |
d03ce0c0 | 150 | |
8132c0e4 SK |
151 | pull: |
152 | find home -type f -print0 \ | |
0b63d662 SK |
153 | | $(SED) -z 's/^home\///g' \ |
154 | | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%' | |
8132c0e4 | 155 | |
d03ce0c0 SK |
156 | clean: |
157 | rm -rf ./debfiles | |
158 | cd src && make clean |