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