Added makefiles for both vim and dotfiles as a whole.
Rough draft at this point but should work.
This commit is contained in:
parent
d52c85c86d
commit
cd39fb13dc
22
makefile
Normal file
22
makefile
Normal file
|
@ -0,0 +1,22 @@
|
|||
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
cmd_exist = $(shell (command -v $(1) 1>&2 >/dev/null && echo true || echo false) )
|
||||
|
||||
install: | init update
|
||||
|
||||
init: vim_init tmux_init
|
||||
update: vim_update
|
||||
|
||||
tmux_init:
|
||||
$(info => Setting up tmux)
|
||||
@ [ $(call cmd_exist,'tmux') ] \
|
||||
&& ! [ -e ~/.tmux.conf ] \
|
||||
&& ln -svf $(SRC_DIR)/tmux/tmux.conf ~/.tmux.conf \
|
||||
|| echo " ~/.tmux.conf already exist. Skipping."
|
||||
|
||||
vim_init:
|
||||
@ $(MAKE) -C $(SRC_DIR)/vim init
|
||||
vim_update:
|
||||
@ $(MAKE) -C $(SRC_DIR)/vim update
|
||||
|
||||
.PHONY: install update init foo
|
25
vim/makefile
Normal file
25
vim/makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
TARGET_DIR := "~/.vim"
|
||||
INSTALLED := $(shell command -v vim 1>&2 >/dev/null ; echo $$? )
|
||||
|
||||
install: | init update
|
||||
|
||||
init:
|
||||
ifneq ($(INSTALLED), 0)
|
||||
$(error Vim not installed)
|
||||
endif
|
||||
$(info => Setting up vim)
|
||||
@ [ -e ~/.vim ] && echo " ~/.vim already exist. Skipping." || "ln -svf $(SRC_DIR) $(TARGET_DIR)"
|
||||
@ [ -e ~/.vim ] && echo " ~/.vimrc already exist. Skipping." || "ln -svf $(TARGET_DIR)/vimrc ~/.vimrc"
|
||||
|
||||
update:
|
||||
$(info => Updating vim)
|
||||
@ curl -fsLo $(SRC_DIR)/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
@ [ $(INSTALLED) -ne 0 ] || vim +PlugInstall +PlugUpdate +qall
|
||||
|
||||
remove:
|
||||
@ [ -L ~/.vimrc ] && rm -f ~/.vimrc || echo "~/.vimrc is not a symbolic link. Skipping"
|
||||
@ [ -L ~/.vim ] && rm -f ~/.vim || echo "~/.vim is not a symbolic link. Skipping"
|
||||
|
||||
|
||||
.PHONY: install update init
|
Loading…
Reference in New Issue
Block a user