-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (131 loc) · 4.25 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
# Makefile
# Where to install files
# DEBUG: prefix=$(shell echo $$HOME/TMP)
prefix=$(shell echo $$HOME)
# prefix=/Users/david.atchley/TMP
# debug mode, for dryrun testing
debug=0
SRC=$(shell pwd)/src
DOT_FILES=$(SRC)/.bash_profile $(SRC)/.gitconfig $(SRC)/.git-completion.bash $(SRC)/.vimrc $(SRC)/.jshintrc
INSTALL_OPTS=
INSTALL_CMD=$(shell which install)
# Dependencies
PATCH=$(shell which patch)
ACK=$(shell which ack)
## dummy commands for testing makefile
ifeq ($(debug), 1)
INSTALL=echo "(debug) install "
CP=echo "(debug) cp "
PATCH=echo "(debug) patch "
MKDIR=echo "(debug) mkdir "
else
INSTALL=$(INSTALL_CMD) $(INSTALL_OPTS)
CP=$(shell which cp)
PATCH=$(shell which patch)
MKDIR=$(shell which mkdir)
endif
VIMRC=$(SRC)/.vimrc
VIM_FILES=$(shell find src/.vim -type f | sed -e "s/^src\///g")
VIM_DIRS=autoload \
bundle \
colors \
plugin
VIM_PKG_SRC=src/.vim/bundle
VIM_PKGS=NERD_tree-ack.vim \
ack.vim \
ctrlp.vim \
nerdtree \
php.vim \
syntastic \
vim-airline \
vim-colors-solarized \
vim-fugitive \
vim-nerdtree-tabs \
indentLine
all:
@echo "Usage: make [install|install-dotfiles|install-vim]"
@echo "prefix="$(prefix)
@echo "SRC: "$(SRC)
@echo "VIMRC: "$(VIMRC)
@echo "VIM_PKGS: "$(VIM_PKGS)
@echo "INSTALL: "$(INSTALL)
@echo "CP: "$(CP)
@echo "PATCH: "$(PATCH)
# checks for dependencies
check:
@echo ">>>> Dependency checks:"
@printf "checking for 'patch' ......"
@patch=`which patch`; \
if [ "$$patch" != "" ] ; then \
ver=$$($$patch -v | head -1); \
printf " %s\n" "$$ver" ; \
else \
printf "not found.\n"; \
echo "Missing 'patch' command. Needed to patch syntastic PHP files. Please install git first"; \
exit 1; \
fi
@printf "checking for 'ack' ......"
@ack=`which ack`; \
if [ "$$ack" != "" ] ; then \
ver=$$($$ack --version | head -1); \
printf " %s\n" "$$ver" ; \
else \
printf "not found.\n"; \
echo "Missing 'ack' command."; \
exit 1; \
fi
install-start:
@echo ">>>> Installing files:"
# install .vimrc and .vim/ files and packages
install-vim:
@echo "Installing .vimrc (backing up original) ...."
$(INSTALL) -b $(VIMRC) $(prefix)
@echo "Installing .vim directory files ...."
@for d in $(VIM_DIRS) ; do \
echo "-> "$$d ; \
! test -d $(prefix)/.vim/$$d && $(MKDIR) -p $(prefix)/.vim/$$d ; \
$(CP) -rf $(SRC)/.vim/$$d/* $(prefix)/.vim/$$d/ ; \
done
@echo "Installing vim packages ...."
@for f in $(VIM_PKGS) ; do \
echo "-> "$$f ; \
if [ -f $(VIM_PKG_SRC)/$$f ]; then \
$(CP) -f $(VIM_PKG_SRC)/$$f $(prefix)/.vim/bundle/ ; \
else \
! test -d $(prefix)/.vim/bundle/$$f && $(MKDIR) -p $(prefix)/.vim/bundle/$$f ; \
$(CP) -rf $(SRC)/.vim/bundle/$$f/* $(prefix)/.vim/bundle/$$f ; \
fi \
done
@echo "Patching syntastic PHP parser ...."
$(PATCH) -u $(prefix)/.vim/bundle/syntastic/syntax_checkers/php/php.vim $(SRC)/syntastic-php.patch ; \
# dircolors configuration for terminal output
install-dircolors:
@echo "Installing solarized colors for terminal ...."
$(INSTALL) $(SRC)/.dircolors-solarized $(prefix)
$(INSTALL) $(SRC)/.solarized_dark.itermcolors $(prefix)
$(INSTALL) $(SRC)/.solarized_light.itermcolors $(prefix)
@echo "See INSTALLATION NOTES for use"
# Make sure to backup original dotfiles
install-dotfiles:
@echo "Installing '.' files in home directory (backing up originals) ...."
@@for f in $(DOT_FILES) ; do \
echo "-> " `basename $$f` ; \
$(INSTALL) -b $$f $(prefix) ; \
done
install: check install-start install-vim install-dotfiles install-dircolors
@echo
@echo "=== Complete!"
@echo "=== ----------------------------------------------------------------------"
@echo "=== INSTALLATION NOTES:"
@echo "=== - All original files were backed up with a '.ORIG' extension"
@echo "=== - You can install the provided Solarized Dark iTerm2 color theme "
@echo "=== as follows: "
@echo "==="
@echo "=== 1. In iTerm2, open 'iTerm2 > Preferences > Profiles > Colors', and "
@echo "=== click 'Load Presets…'"
@echo "=== 2. Select the file ~/solarized_dark.itermcolors or ~/solarized_light.itermcolors"
@echo "==="
@echo "=== - To remove the directory terminal colors, simpley comment out the "
@echo "=== line in .bash_profile that calls 'eval dircolors .dircolors-solarized' "
@echo "==="
@echo "=== ----------------------------------------------------------------------"