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