Enhance makefile to check for links before linking, to avoid make errors.
This commit is contained in:
parent
cb731053f4
commit
9c4adaee4c
1 changed files with 39 additions and 5 deletions
44
makefile
44
makefile
|
@ -4,6 +4,7 @@
|
|||
link-dotfiles \
|
||||
build-default \
|
||||
build-simple \
|
||||
clean-all \
|
||||
install-vim-config \
|
||||
install-vim-dir \
|
||||
install-vim-plugin \
|
||||
|
@ -15,6 +16,8 @@
|
|||
|
||||
.DEFAULT-GOAL := help
|
||||
|
||||
#Utility Recipies
|
||||
|
||||
help: ## Display this menu
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf "%-25s %s\n", $$1, $$2}'
|
||||
|
@ -22,6 +25,8 @@ help: ## Display this menu
|
|||
link-dotfiles: ## Create dotfiles link in Home directory
|
||||
ln -s -- "$(CURDIR)" "$(HOME)"/.dotfiles
|
||||
|
||||
#Bundle Recipies
|
||||
|
||||
build-default: ## Create default environment, using all dotfiles
|
||||
build-default: link-dotfiles \
|
||||
install-vim-config \
|
||||
|
@ -37,21 +42,50 @@ build-simple: ## Create minimal environment, for remote or single-use
|
|||
build-simple: install-vim-config \
|
||||
install-bash-profile
|
||||
|
||||
clean-all: ## Remove all dotfiles linked via this makefile
|
||||
|
||||
#Program Recipies
|
||||
|
||||
install-vim-config: ## Create vimrc file in Home directory
|
||||
ln -s -- "$(CURDIR)"/vim/vimrc "$(HOME)"/.vimrc
|
||||
@if [ -L "$(HOME)"/.vimrc ] ; then \
|
||||
echo "File vimrc already linked; skipping." ; \
|
||||
else \
|
||||
echo "Linking vimrc to ~/.vimrc" ; \
|
||||
ln -s -- "$(CURDIR)"/vim/vimrc "$(HOME)"/.vimrc ; \
|
||||
fi
|
||||
|
||||
install-vim-plugin: ## Create vimrc-plugins (Plugin file) in Home directory
|
||||
ln -s -- "$(CURDIR)"/vim/vimrc-plugins "$(HOME)"/.vimrc-plugins
|
||||
@if [ -L "$(HOME)"/.vimrc-plugins ] ; then \
|
||||
echo "File vimrc-plugins already linked; skipping." ; \
|
||||
else \
|
||||
echo "Linking vimrc-plugins to ~/.vimrc-plugins" ; \
|
||||
ln -s -- "$(CURDIR)"/vim/vimrc-plugins "$(HOME)"/.vimrc-plugins ; \
|
||||
fi
|
||||
|
||||
install-vim-dir: ## Create vim directory in Home directory
|
||||
ln -s -- "$(CURDIR)"/vim/vim/ "$(HOME)"/.vim
|
||||
|
||||
install-git: ## Create git config and ignore files in Home directory
|
||||
ln -s -- "$(CURDIR)"/git/gitconfig "$(HOME)"/.gitconfig
|
||||
ln -s -- "$(CURDIR)"/git/gitignore "$(HOME)"/.gitignore
|
||||
@if [ -L "$(HOME)"/.gitconfig ] ; then \
|
||||
echo "File gitconfig already linked; skipping." ; \
|
||||
else \
|
||||
echo "Linking gitconfig to ~/.gitconfig" ; \
|
||||
ln -s -- "$(CURDIR)"/git/gitconfig "$(HOME)"/.gitconfig ; \
|
||||
fi
|
||||
@if [ -L "$(HOME)"/.gitignore ] ; then \
|
||||
echo "File gitignore already linked; skipping." ; \
|
||||
else \
|
||||
echo "Linking gitignore to ~/.gitignore" ; \
|
||||
ln -s -- "$(CURDIR)"/git/gitignore "$(HOME)"/.gitignore ; \
|
||||
fi
|
||||
|
||||
install-tmux: ## Create tmux config file in Home directory
|
||||
ln -s -- "$(CURDIR)"/tmux/tmux.conf "$(HOME)"/.tmux.conf
|
||||
@if [ -L "$(HOME)"/.tmux.conf ] ; then \
|
||||
echo "File tmux.conf already linked; skipping." ; \
|
||||
else \
|
||||
echo "Linking tmux.conf to ~/.tmux.conf" ; \
|
||||
ln -s -- "$(CURDIR)"/tmux/tmux.conf "$(HOME)"/.tmux.conf ; \
|
||||
fi
|
||||
|
||||
install-bash-config: ## Create bash config file in Home directory
|
||||
|
||||
|
|
Loading…
Reference in a new issue