-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.12 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
DOTFILES = ctags gitconfig githelpers screenrc vim vimrc tmux.conf zshrc zprofile
DOTFILE_DEST := $(DOTFILES:%=~/.%)
DOTDIRS := $(filter-out ./,$(dir $(DOTFILES)))
DOTDIR_DEST := $(DOTDIRS:%=~/.%)
UNAME := $(shell uname -s)
COMMAND_T_DIR := vim/bundle/command-t
ifeq ($(UNAME),Darwin)
RAKE := $(shell brew --prefix)/opt/ruby/bin/rake
COMMAND_T_LIB := $(COMMAND_T_DIR)/ruby/command-t/ext.bundle
else
RAKE := /usr/bin/rake
COMMAND_T_LIB := $(COMMAND_T_DIR)/ruby/command-t/ext.so
endif
.PHONY: all links commandt rake clean
all: links commandt
links: $(DOTDIR_DEST) $(DOTFILE_DEST)
$(DOTDIR_DEST):
mkdir -p $@
$(DOTFILE_DEST): $(wildcard ~/).%: %
ln -s $(addprefix dotfiles/,$<) $@
commandt: $(COMMAND_T_LIB)
$(COMMAND_T_LIB): $(RAKE)
cd $(COMMAND_T_DIR) && $(RAKE) make
$(RAKE):
ifeq ($UNAME),Darwin)
brew install ruby
endif
ifeq ($UNAME),Linux)
CODENAME := $(shell lsb_release -a 2>/dev/null | awk '/Codename/ { print $$2 }')
ifeq ($CODENAME),precise)
apt-get install build-essential ruby ruby-dev rake
else
apt install build-essential ruby2.3 ruby2.3-dev rake
endif
endif
clean:
-rm $(DOTFILE_DEST)
-rm -rf $(COMMAND_T_LIB)