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