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