aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: ca2f858332af61c3ce8870eda965bb082e447ffb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
.PHONY : all \
	clean \
	distclean \
	install \
	install-abook \
	install-bash \
	install-bash-completion \
	install-bin \
	install-bin-man \
	install-curl \
	install-dotfiles-man \
	install-dunst \
	install-ex \
	install-finger \
	install-games \
	install-games-man \
	install-git \
	install-gnupg \
	install-gtk \
	install-i3 \
	install-less \
	install-mutt \
	install-ncmcpp \
	install-newsbeuter \
	install-mysql \
	install-ksh \
	install-perlcritic \
	install-perltidy \
	install-psql \
	install-readline \
	install-sh \
	install-subversion \
	install-tmux \
	install-urxvt \
	install-vim \
	install-gvim \
	install-vim-config \
	install-gvim-config \
	install-vim-plugins \
	install-vim-pathogen \
	install-x \
	install-yash \
	install-zsh \
	check \
	check-bash \
	check-bin \
	check-games \
	check-ksh \
	check-sh \
	check-urxvt \
	check-yash \
	check-zsh \
	lint \
	lint-bash \
	lint-bin \
	lint-games \
	lint-ksh \
	lint-yash \
	lint-sh \
	lint-urxvt

.SUFFIXES: .awk .bash .pl .sed

NAME := Tom Ryder
EMAIL := tom@sanctum.geek.nz
KEY := 0xC14286EA77BB8872
SENDMAIL := msmtp

BINS = bin/brnl \
	bin/csmw \
	bin/ddup \
	bin/gwp \
	bin/han \
	bin/hms \
	bin/htdec \
	bin/htenc \
	bin/htref \
	bin/jfp \
	bin/max \
	bin/mean \
	bin/med \
	bin/mftl \
	bin/min \
	bin/mode \
	bin/nlbr \
	bin/onl \
	bin/quo \
	bin/rfct \
	bin/rndi \
	bin/sd2u \
	bin/sec \
	bin/slsf \
	bin/su2d \
	bin/tot \
	bin/unf \
	bin/uts \
	bin/xrq

GAMES = games/acq \
	games/aesth \
	games/chkl \
	games/drakon \
	games/kvlt \
	games/rot13 \
	games/strik \
	games/zs

all : $(BINS) git/gitconfig gnupg/gpg.conf

clean distclean :
	rm -f \
		$(BINS) \
		$(GAMES) \
		git/gitconfig \
		gnupg/gpg.conf \
		man/man8/dotfiles.7df \
		tmux/tmux.conf \
		urxvt/ext/select

git/gitconfig : git/gitconfig.m4
	m4 \
		-D DOTFILES_NAME="$(NAME)" \
		-D DOTFILES_EMAIL="$(EMAIL)" \
		-D DOTFILES_KEY="$(KEY)" \
		-D DOTFILES_SENDMAIL="$(SENDMAIL)" \
		git/gitconfig.m4 > git/gitconfig

KEYSERVER := hkps://hkps.pool.sks-keyservers.net

gnupg/gpg.conf : gnupg/gpg.conf.m4
	m4 \
		-D DOTFILES_HOME="$(HOME)" \
		-D DOTFILES_KEYSERVER="$(KEYSERVER)" \
		gnupg/gpg.conf.m4 > gnupg/gpg.conf

man/man7/dotfiles.7df : README.markdown man/man7/dotfiles.7df.header
	cat man/man7/dotfiles.7df.header README.markdown | \
		pandoc -sS -t man -o "$@"

MAILDIR := $(HOME)/Mail

TMUX_BG := colour237
TMUX_FG := colour248

tmux/tmux.conf : tmux/tmux.conf.m4
	m4 -D TMUX_BG="$(TMUX_BG)" -D TMUX_FG="$(TMUX_FG)" \
		tmux/tmux.conf.m4 > tmux/tmux.conf

.awk :
	bin/shb "$<" awk -f > "$@"
	chmod +x "$@"

.bash :
	bin/shb "$<" bash > "$@"
	chmod +x "$@"

.pl :
	bin/shb "$<" perl > "$@"
	chmod +x "$@"

.sed :
	bin/shb "$<" sed -f > "$@"
	chmod +x "$@"

install : install-bash \
	install-bash-completion \
	install-bin \
	install-curl \
	install-ex \
	install-git \
	install-gnupg \
	install-less \
	install-readline \
	install-sh \
	install-vim

install-abook :
	mkdir -p -- \
		"$(HOME)"/.abook
	cp -p -- abook/abookrc "$(HOME)"/.abook

install-bash : check-bash install-sh
	mkdir -p -- \
		"$(HOME)"/.config \
		"$(HOME)"/.bashrc.d
	cp -p -- bash/bashrc "$(HOME)"/.bashrc
	cp -p -- bash/bashrc.d/* "$(HOME)"/.bashrc.d
	cp -p -- bash/bash_profile "$(HOME)"/.bash_profile
	cp -p -- bash/bash_logout "$(HOME)"/.bash_logout

install-bash-completion : install-bash
	mkdir -p -- "$(HOME)"/.bash_completion.d
	cp -p -- bash/bash_completion "$(HOME)"/.config/bash_completion
	cp -p -- bash/bash_completion.d/* "$(HOME)"/.bash_completion.d

install-bin : $(BINS) install-bin-man
	mkdir -p -- "$(HOME)"/.local/bin
	for name in bin/* ; do \
		[ -x "$$name" ] || continue ; \
		cp -p -- "$$name" "$(HOME)"/.local/bin ; \
	done

install-bin-man :
	mkdir -p -- \
		"$(HOME)"/.local/share/man/man1 \
		"$(HOME)"/.local/share/man/man8
	cp -p -- man/man1/*.1df "$(HOME)"/.local/share/man/man1
	cp -p -- man/man8/*.8df "$(HOME)"/.local/share/man/man8

install-curl :
	cp -p -- curl/curlrc "$(HOME)"/.curlrc

install-dotfiles-man : man/man7/dotfiles.7df
	mkdir -p -- "$(HOME)"/.local/share/man/man7
	cp -p -- man/man7/*.7df "$(HOME)"/.local/share/man/man7

install-dunst : install-x
	mkdir -p -- "$(HOME)"/.config/dunst
	cp -p -- dunst/dunstrc "$(HOME)"/.config/dunst

install-ex :
	cp -p -- ex/exrc "$(HOME)"/.exrc

install-finger :
	cp -p -- finger/plan "$(HOME)"/.plan
	cp -p -- finger/project "$(HOME)"/.project
	cp -p -- finger/pgpkey "$(HOME)"/.pgpkey

install-games : $(GAMES) install-games-man
	mkdir -p -- "$(HOME)"/.local/games
	for name in games/* ; do \
		[ -x "$$name" ] || continue ; \
		cp -p -- "$$name" "$(HOME)"/.local/games ; \
	done

install-games-man :
	mkdir -p -- "$(HOME)"/.local/share/man/man6
	cp -p -- man/man6/*.6df "$(HOME)"/.local/share/man/man6

install-git : git/gitconfig
	cp -p -- git/gitconfig "$(HOME)"/.gitconfig

install-gnupg : gnupg/gpg.conf
	mkdir -m 0700 -p -- \
		"$(HOME)"/.gnupg \
		"$(HOME)"/.gnupg/sks-keyservers.net
	cp -p -- gnupg/*.conf "$(HOME)"/.gnupg
	cp -p -- gnupg/sks-keyservers.net/* \
		"$(HOME)"/.gnupg/sks-keyservers.net

install-gtk :
	mkdir -p -- \
		"$(HOME)"/.config/gtkrc-3.0
	cp -p -- gtk/gtkrc-2.0 "$(HOME)"/.gtkrc-2.0
	cp -p -- gtk/gtkrc-3.0/settings.ini "$(HOME)"/.config/gtkrc-3.0

install-i3 : install-x
	mkdir -p -- "$(HOME)"/.i3
	cp -p -- i3/* "$(HOME)"/.i3

install-less :
	cp -p -- less/lesskey "$(HOME)"/.lesskey
	command -v lesskey && lesskey

install-mutt :
	mkdir -p -- \
		"$(HOME)"/.muttrc.d \
		"$(HOME)"/.cache/mutt
	cp -p -- mutt/muttrc "$(HOME)"/.muttrc
	cp -p -- mutt/muttrc.d/src "$(HOME)"/.muttrc.d

install-ncmcpp :
	mkdir -p -- "$(HOME)"/.ncmpcpp
	cp -p -- ncmpcpp/config "$(HOME)"/.ncmpcpp/config

install-newsbeuter :
	mkdir -p -- \
		"$(HOME)"/.config/newsbeuter \
		"$(HOME)"/.local/share/newsbeuter
	cp -p -- newsbeuter/config "$(HOME)"/.config/newsbeuter/config

install-mysql :
	cp -p -- mysql/my.cnf "$(HOME)"/.my.cnf

install-ksh : check-ksh install-sh
	mkdir -p -- \
		"$(HOME)"/.shrc.d \
		"$(HOME)"/.kshrc.d
	cp -p -- ksh/shrc.d/* "$(HOME)"/.shrc.d
	cp -p -- ksh/kshrc "$(HOME)"/.kshrc
	cp -p -- ksh/kshrc.d/* "$(HOME)"/.kshrc.d

install-perlcritic :
	cp -p -- perlcritic/perlcriticrc "$(HOME)"/.perlcriticrc

install-perltidy :
	cp -p -- perltidy/perltidyrc "$(HOME)"/.perltidyrc

install-psql :
	cp -p -- psql/psqlrc "$(HOME)"/.psqlrc

install-readline :
	cp -p -- readline/inputrc "$(HOME)"/.inputrc

install-sh : check-sh
	mkdir -p -- \
		"$(HOME)"/.profile.d \
		"$(HOME)"/.shrc.d
	cp -p -- sh/profile "$(HOME)"/.profile
	cp -p -- sh/profile.d/* "$(HOME)"/.profile.d
	cp -p -- sh/shinit "$(HOME)"/.shinit
	cp -p -- sh/shrc "$(HOME)"/.shrc
	cp -p -- sh/shrc.d/* "$(HOME)"/.shrc.d

install-subversion :
	mkdir -p -- "$(HOME)"/.subversion
	cp -p -- subversion/config "$(HOME)"/.subversion/config

install-terminfo :
	for info in terminfo/*.info ; do \
		tic -- "$$info" ; \
	done

install-tmux : tmux/tmux.conf install-terminfo
	cp -p -- tmux/tmux.conf "$(HOME)"/.tmux.conf

install-urxvt : urxvt/ext/select check-urxvt
	mkdir -p -- "$(HOME)"/.urxvt/ext
	for name in urxvt/ext/* ; do \
		case $$name in \
			*.pl) ;; \
			*) cp -p -- "$$name" "$(HOME)"/.urxvt/ext ;; \
		esac \
	done

install-vim : install-vim-config \
	install-vim-plugins \
	install-vim-pathogen

install-gvim : install-vim \
	install-gvim-config

install-vim-config :
	cp -p -- vim/vimrc "$(HOME)"/.vimrc

install-gvim-config :
	cp -p -- vim/gvimrc "$(HOME)"/.gvimrc

install-vim-plugins : install-vim-config
	find vim/after vim/bundle -name .git -prune -o \
		-type d -exec sh -c 'mkdir -p -- \
			"$(HOME)"/."$$1"' _ {} \; -o \
		-type f -exec sh -c 'cp -p -- \
			"$$1" "$(HOME)"/."$$1"' _ {} \;

install-vim-pathogen : install-vim-plugins
	mkdir -p -- "$(HOME)"/.vim/autoload
	rm -f -- "$(HOME)"/.vim/autoload/pathogen.vim
	ln -s -- ../bundle/pathogen/autoload/pathogen.vim \
		"$(HOME)"/.vim/autoload/pathogen.vim

install-x :
	mkdir -p -- \
		"$(HOME)"/.config \
		"$(HOME)"/.xinitrc.d \
		"$(HOME)"/.Xresources.d
	cp -p -- X/redshift.conf "$(HOME)"/.config/redshift.conf
	cp -p -- X/xbindkeysrc "$(HOME)"/.xbindkeysrc
	cp -p -- X/xinitrc "$(HOME)"/.xinitrc
	cp -p -- X/xinitrc.d/* "$(HOME)"/.xinitrc.d
	cp -p -- X/Xresources "$(HOME)"/.Xresources
	cp -p -- X/Xresources.d/* "$(HOME)"/.Xresources.d

install-yash : check-yash install-sh
	mkdir -p -- "$(HOME)"/.yashrc.d
	cp -p -- yash/yash_profile "$(HOME)"/.yash_profile
	cp -p -- yash/yashrc "$(HOME)"/.yashrc
	cp -p -- yash/yashrc.d/* "$(HOME)"/.yashrc.d

install-zsh : check-zsh install-sh
	mkdir -p -- \
		"$(HOME)"/.profile.d \
		"$(HOME)"/.zshrc.d
	cp -p -- zsh/profile.d/* "$(HOME)"/.profile.d
	cp -p -- zsh/zprofile "$(HOME)"/.zprofile
	cp -p -- zsh/zshrc "$(HOME)"/.zshrc
	cp -p -- zsh/zshrc.d/* "$(HOME)"/.zshrc.d

check : check-bash \
	check-bin \
	check-games \
	check-man \
	check-sh \
	check-urxvt

check-bash :
	check/bash

check-bin : $(BINS)
	check/bin

check-games : $(GAMES)
	check/games

check-man :
	check/man

check-ksh :
	check/ksh

check-sh :
	check/sh

check-urxvt :
	check/urxvt

check-yash :
	check/yash

check-zsh :
	check/zsh

lint : check \
	lint-bash \
	lint-bin \
	lint-games \
	lint-ksh \
	lint-sh \
	lint-urxvt \
	lint-yash

lint-bash :
	lint/bash

lint-bin : $(BINS)
	lint/bin

lint-games : $(GAMES)
	lint/games

lint-ksh :
	lint/ksh

lint-sh :
	lint/sh

lint-urxvt :
	lint/urxvt

lint-yash :
	lint/yash