Switch weather format to v2
[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 \
30 pkgs_snap_classic \
31 pkgs_snap_strict
32
33 default:
34 @echo '================================================================================'
35 @echo '| Default target disabled. Specify a concrete one.'
36 @echo '================================================================================'
37 @exit 1
38
39 home: mpdconf compiled
40 @cp -Rp bin $(HOME)/
41 @cp -Rp home/bin $(HOME)/
42 @cp -Rp home/lib $(HOME)/
43 @cp home/.compton.conf $(HOME)/
44 @cp -Rp home/.config/ $(HOME)/
45 @cp -Rp home/.newsboat/ $(HOME)/
46 @cp home/.profile $(HOME)/
47 @cp home/.fonts.conf $(HOME)/
48 @cp home/.Rprofile $(HOME)/
49 @cp home/.tmux.conf $(HOME)/
50 @cp home/.xbindkeysrc $(HOME)/
51
52 mpdconf:
53 @mkdir -p ~/Archives/Audio
54 @mkdir -p ~/var/lib/mpd/playlists
55 @mkdir -p ~/var/log/mpd
56 @mkdir -p ~/var/run/mpd
57 @cp home/.mpdconf $(HOME)/
58
59 compiled:
60 mkdir -p bin
61 cd src && make
62 mv src/clockloop bin/
63
64 font_cache:
65 @fc-cache -fv
66
67 #
68 # Golang
69 #
70 pkgs_golang: list pkgs-golang.list
71 go get $(shell ./list pkgs-golang.list)
72
73 #
74 # Ubuntu
75 #
76 pkgs_ubuntu: list pkgs-ubuntu.list
77 sudo apt install $(shell ./list pkgs-ubuntu.list)
78
79 pkgs_ubuntu_debfiles: list pkgs-ubuntu-debfiles.list
80 ./install-debfiles pkgs-ubuntu-debfiles.list
81
82 #
83 # PIP
84 #
85 pkgs_pip:
86 sudo pip3 install $(shell ./list pkgs-pip.list)
87
88 #
89 # Rust (cargo)
90 #
91
92 pkgs_cargo: list pkgs-cargo.list
93 cargo install $(shell ./list pkgs-cargo.list)
94
95 #
96 # Homebrew/Mac
97 #
98
99 pkgs_mac:
100 $(MAKE) pkgs_brew_install
101 $(MAKE) pkgs_brew_cask_install
102
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
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
113 #
114 # Debian
115 #
116 pkgs_deb_install: list pkgs-deb-install.list
117 sudo apt install $(shell ./list pkgs-deb-install.list)
118
119 pkgs_deb_purge: list pkgs-deb-purge.list
120 sudo apt purge $(shell ./list pkgs-deb-purge.list)
121
122 #
123 # Snap
124 #
125 pkgs_snap_classic: list pkgs-snap-classic.list
126 @$(MAKE) $(foreach p,$(shell ./list pkgs-snap-classic.list),pkg_snap_classic_$(p))
127
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
132 pkg_snap_classic_%:
133 sudo snap install --classic $*
134 pkg_snap_strict_%:
135 sudo snap install $*
136
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))))
145
146 diff:
147 find home -type f -print0 \
148 | $(SED) -z 's/^home\///g' \
149 | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=always ~/% home/%'
150
151 pull:
152 find home -type f -print0 \
153 | $(SED) -z 's/^home\///g' \
154 | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%'
155
156 clean:
157 rm -rf ./debfiles
158 cd src && make clean
This page took 0.054254 seconds and 4 git commands to generate.