aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 24006419a673fa29535d3a70fc41797a58b2bb80 (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
.PHONY: all \
	clean \
	distclean \
	gnupg \
	vim \
	vim-plugins \
	install \
	install-bash \
	install-bin \
	install-curl \
	install-dircolors \
	install-git \
	install-gnupg \
	install-gvim \
	install-gvim-config \
	install-i3 \
	install-maildir \
	install-mutt \
	install-mysql \
	install-ncmcpp \
	install-newsbeuter \
	install-psql \
	install-readline \
	install-sh \
	install-task \
	install-terminfo \
	install-tmux \
	install-urxvt \
	install-vim \
	install-vim-config \
	install-vim-pathogen \
	install-vim-plugins \
	install-vimperator \
	install-wyrd \
	install-x \
	test \
	test-bash \
	test-bin \
	test-sh \
	test-urxvt

all : gnupg vim

clean :
	rm -f gnupg/gpg.conf

distclean : clean

gnupg : gnupg/gpg.conf

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

install : install-bash \
	install-curl \
	install-dircolors \
	install-git \
	install-gnupg \
	install-readline \
	install-sh \
	install-terminfo \
	install-vim

install-bash : test-bash
	install -m 0755 -d -- \
		"$(HOME)"/.config \
		"$(HOME)"/.bashrc.d
	install -m 0644 -- bash/bashrc "$(HOME)"/.bashrc
	install -m 0644 -- bash/bashrc.d/* "$(HOME)"/.bashrc.d
	install -m 0644 -- bash/bash_profile "$(HOME)"/.bash_profile
	install -m 0644 -- bash/bash_logout "$(HOME)"/.bash_logout
	install -m 0644 -- bash/bash_completion "$(HOME)"/.config/bash_completion

install-bin : test-bin
	install -m 0755 -d -- \
		"$(HOME)"/.local/bin \
		"$(HOME)"/.local/share/man/man1
	install -m 0755 -- bin/* "$(HOME)"/.local/bin
	install -m 0644 -- man/* "$(HOME)"/.local/share/man/man1

install-curl :
	install -m 0644 -- curl/curlrc "$(HOME)"/.curlrc

install-dircolors :
	install -m 0644 -- dircolors/dircolors "$(HOME)"/.dircolors

install-git :
	install -m 0644 -- git/gitconfig "$(HOME)"/.gitconfig

install-gnupg : gnupg/gpg.conf
	install -m 0700 -d -- \
		"$(HOME)"/.gnupg \
		"$(HOME)"/.gnupg/sks-keyservers.net
	install -m 0600 -- gnupg/*.conf "$(HOME)"/.gnupg
	install -m 0644 -- gnupg/sks-keyservers.net/* \
		"$(HOME)"/.gnupg/sks-keyservers.net

install-i3 : install-x
	install -m 0755 -d -- "$(HOME)"/.i3
	install -m 0644 -- i3/* "$(HOME)"/.i3

install-maildir :
	install -m 0755 -d -- \
		"$(HOME)"/Mail/inbox/cur \
		"$(HOME)"/Mail/inbox/new \
		"$(HOME)"/Mail/inbox/tmp \
		"$(HOME)"/Mail/sent/cur \
		"$(HOME)"/Mail/sent/new \
		"$(HOME)"/Mail/sent/tmp

install-mutt : install-maildir
	install -m 0755 -d -- \
		"$(HOME)"/.mutt \
		"$(HOME)"/.cache/mutt
	install -m 0644 -- mutt/muttrc "$(HOME)"/.muttrc

install-ncmcpp :
	install -m 0755 -d -- "$(HOME)"/.ncmpcpp
	install -m 0644 -- ncmpcpp/config "$(HOME)"/.ncmpcpp/config

install-newsbeuter :
	install -m 0755 -d -- \
		"$(HOME)"/.config/newsbeuter \
		"$(HOME)"/.local/share/newsbeuter
	install -m 0644 -- newsbeuter/config "$(HOME)"/.config/newsbeuter/config

install-mysql :
	install -m 0644 -- mysql/my.cnf "$(HOME)"/.my.cnf

install-psql :
	install -m 0644 -- psql/psqlrc "$(HOME)"/.psqlrc

install-readline :
	install -m 0644 -- readline/inputrc "$(HOME)"/.inputrc

install-sh : test-sh
	install -m 0755 -d -- "$(HOME)"/.profile.d
	install -m 0644 -- sh/profile "$(HOME)"/.profile
	install -m 0644 -- sh/profile.d/* "$(HOME)"/.profile.d

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

install-task :
	install -m 0644 -- task/taskrc "$(HOME)"/.taskrc

install-tmux :
	install -m 0644 -- tmux/tmux.conf "$(HOME)"/.tmux.conf

install-urxvt : test-urxvt
	install -m 0755 -d -- "$(HOME)"/.urxvt/ext
	install -m 0755 -- urxvt/ext/* "$(HOME)"/.urxvt/ext

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

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

install-vim-config :
	install -m 0644 -- vim/vimrc "$(HOME)"/.vimrc

install-gvim-config :
	install -m 0644 -- vim/gvimrc "$(HOME)"/.gvimrc

install-vim-plugins : vim-plugins install-vim-config
	install -m 0755 -d -- "$(HOME)"/.vim/bundle
	find vim/bundle -name .git -prune -o \
		\( -type d -print \) | \
			while IFS= read -r dir ; do \
				install -m 0755 -d -- \
					"$$dir" "$(HOME)"/.vim/"$${dir#vim/}" ; \
			done
	find vim/bundle -name .git -prune -o \
		\( -type f ! -name '.git*' -print \) | \
			while IFS= read -r file ; do \
				install -m 0644 -- \
					"$$file" "$(HOME)"/.vim/"$${file#vim/}" ; \
			done
	for dir in vim/after/* ; do \
		install -m 0755 -d -- "$(HOME)"/.vim/after/"$${dir##*/}" ; \
		install -m 0644 -- "$$dir"/* \
			"$(HOME)"/.vim/after/"$${dir##*/}" ; \
	done

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

install-vimperator :
	install -m 0644 -- vimperator/vimperatorrc "$(HOME)"/.vimperatorrc

install-wyrd :
	install -m 0644 -- wyrd/wyrdrc "$(HOME)"/.wyrdrc

install-x :
	install -m 0755 -d -- "$(HOME)"/.config
	install -m 0644 -- X/redshift.conf "$(HOME)"/.config/redshift.conf
	install -m 0644 -- X/Xresources "$(HOME)"/.Xresources
	install -m 0644 -- X/xbindkeysrc "$(HOME)"/.xbindkeysrc
	install -m 0644 -- X/xinitrc "$(HOME)"/.xinitrc

test : test-sh test-bash test-bin test-urxvt

test-sh :
	@for sh in sh/* sh/profile.d/* ; do \
		if [ -f "$$sh" ] && ! sh -n "$$sh" ; then \
			exit 1 ; \
		fi \
	done
	@echo "All sh(1) scripts parsed successfully."

test-bash :
	@for bash in bash/* bash/bashrc.d/* ; do \
		if [ -f "$$bash" ] && ! bash -n "$$bash" ; then \
			exit 1 ; \
		fi \
	done
	@echo "All bash(1) scripts parsed successfully."

test-bin :
	@for bin in bin/* ; do \
		if sed 1q "$$bin" | grep -q bash ; then \
			bash -n "$$bin" || exit 1 ; \
		elif sed 1q "$$bin" | grep -q sh ; then \
			sh -n "$$bin" || exit 1 ; \
		fi ; \
	done
	@echo "All shell scripts in bin parsed successfully."

test-urxvt:
	@for perl in urxvt/ext/* ; do \
		perl -c "$$perl" >/dev/null || exit 1 ; \
	done
	@echo "All Perl scripts in urxvt/ext parsed successfully."