-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
179 lines (161 loc) · 4.59 KB
/
Makefile
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
# Activate/deactivate config files as needed
.Phony: help install pydist status vim_pathogen vim_after
help:
@echo "Manage config files"
@echo " help - this message"
@echo " install - create symlinks for common files"
@echo " pydist - toggle local user install of python packages"
@echo " status - report on state of installation"
# all the common rc files
DOT_FILES= \
bash_profile \
bashrc \
editrc \
gitconfig \
gitignore_global \
gitk \
gvimrc \
hgignore \
hgignore_global \
inputrc \
screenrc \
tmux.conf \
tmux.conf.Darwin \
vimrc \
# other targets that install things similar to dotfiles
MISC_TARGETS= \
# vim_pathogen \
# vim_after \
# my scripts
BIN_FILES = \
clean-docker-for-mac.sh \
git-diff-driver \
hg-url \
install_hg_bash_completion \
myscreen \
ppass \
repo_type \
rprompt \
sourceAuthSocket \
super_clear \
tmux-daemon-start \
tmux-start \
tp-due \
useAWS \
useAnaconda \
useDockerWindowsHost \
useMozAWS \
usePipenv \
vim-post-crash \
# ack \
# normal install consists of both scripts and rc files
install: bin_files dot_files # $(MISC_TARGETS)
@echo "# REMEMBER TO EXECUTE THE ABOVE LINES"
ack:
# stay with 1.x as we don't like loss of -a option
curl http://beyondgrep.com/ack-1.96-single-file > $@
chmod 0755 $@
vimack: ack
curl -L https://github.com/mileszs/ack.vim/archive/master.tar.gz > /tmp/ackvim.tgz
tar xzf /tmp/ackvim.tgz -C /tmp/
mkdir -p $(HOME)/.vim/{doc,plugin,after}
for f in /tmp/ack.vim-master/doc/* ; do \
cp -i $$f $(HOME)/.vim/doc/ ; \
done
vim --cmd "helptags $(HOME)/.vim/doc/" --cmd quit
for f in /tmp/ack.vim-master/plugin/* ; do \
cp -i $$f $(HOME)/.vim/plugin/ ; \
done
rm -rf /tmp/ackvim.tgz /tmp/ack.vim-master
vim_after:
@if test -h ~/.vim/after ; then \
echo "#~/.vim/after is already symlinked"; \
elif test -f ~/.vim/after ; then \
echo "#~/.vim/after exists already"; \
else \
echo "ln -s $(PWD)/vim-after ~/.vim/after"; \
fi; \
vim_pathogen:
# see commit message for pathogen.vim for version details
@if test -h ~/.vim/autoload/pathogen.vim ; then \
echo "#~/.vim/autoload/pathogen.vim is already symlinked"; \
elif test -f ~/.vim/autoload/pathogen.vim ; then \
echo "#~/.vim/autoload/pathogen.vim exists already"; \
else \
echo "ln -s $(PWD)/pathogen.vim" ~/.vim/autoload/pathogen.vim; \
fi; \
lesspipe.sh:
curl -O http://www-zeuthen.desy.de/~friebel/unix/less/lesspipe.tar.gz
# expected resources
EXPECTED_FILES = \
# lesspipe.sh \
# ack \
dot_files: $(DOT_FILES)
@symlink() { echo "pushd $(HOME) &>/dev/null; ln -sf $$relpath/$$1 .$$1; popd &>/dev/null" ; } ; \
for f in $?; do \
: relative path from home to here ; \
relpath=$$(eval 'a=$$PWD; a=$${a#$$HOME/}; echo $$a') ; \
: echo $$relpath ; \
if test -h ~/.$$f ; then \
echo "#$$f is already symlinked"; \
: check if correct symlink ; \
link=$$(eval 'readlink ~/.$$f') ; \
: echo $$link ; \
if $$(eval 'test "$$link" = "$${link#$$relpath}"') ; then \
echo "#WARNING: existing rogue symlink" ; \
symlink $$f ; \
fi ; \
elif test -f ~/.$$f ; then \
echo "#$$f exists already"; \
else \
: echo "pushd $(HOME) &>/dev/null; ln -s $$relpath/$$f .$$f; popd &>/dev/null"; \
symlink $$f ; \
fi; \
done
bin_files: $(BIN_FILES)
@for f in $?; do \
if test -h ~/bin/$$f ; then \
echo "#$$f is already symlinked"; \
elif test -f ~/bin/$$f ; then \
echo "#$$f exists already"; \
else \
echo "ln -s $(PWD)/$$f" ~/bin/$$f; \
fi; \
done
# toggle ability to install into ~/Library
pydist:
@echo "No longer supported" ; false
@if test -h ~/.pydistutils.cfg ; then \
unlink ~/.pydistutils.cfg ; \
echo "local package install disabled" ; \
elif test -f $(PWD)/pydistutils.cfg ; then \
ln -s $(PWD)/pydistutils.cfg ~/.pydistutils.cfg; \
echo "local package install enabled" ; \
else \
echo "local package install NOT enabled" ; \
echo "you may be in the wrong directory" ; \
exit 1 ; \
fi
# report on exceptions to full install
status:
@for f in $(DOT_FILES); do \
if ! test -h ~/.$$f ; then \
echo "WARNING: not using ./.$$f"; \
fi; \
done
@for f in $(BIN_FILES); do \
if ! test -h ~/bin/$$f ; then \
echo "WARNING: ~/bin/$$f is NOT active"; \
fi; \
done
@for f in $(EXPECTED_FILES); do \
if ! type -p $$f &>/dev/null ; then \
echo "WARNING: $$f not installed on system"; \
fi; \
done
@if test -h ~/.pydistutils.cfg ; then \
echo "WARNING: local package install enabled" ; \
fi
@if ! git status | grep -q '^nothing to commit' ; then \
echo "WARNING: uncommited changes" ; \
fi