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