dotfiles/Makefile

35 lines
1.0 KiB
Makefile
Raw Normal View History

DOTPATH := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
CANDIDATES := $(wildcard .??*)
EXCLUSIONS := .DS_Store .git .gitmodules .gitignore init
DOTFILES := $(filter-out $(EXCLUSIONS), $(CANDIDATES))
all: install
help:
@echo "make list #=> Show dot files in this repo"
@echo "make deploy #=> Create symlink to home directory"
@echo "make update #=> Fetch changes for this repo"
@echo "make install #=> Run make update, deploy, init"
@echo "make clean #=> Remove the dot files and this repo"
list:
@$(foreach val, $(DOTFILES), /bin/ls -dF $(val);)
deploy:
@echo '==> Start to deploy dotfiles to home directory.'
@echo ''
@$(foreach val, $(DOTFILES), ln -sfnv $(abspath $(val)) $(HOME)/$(val);)
update:
git pull origin master
git submodule init
git submodule update
git submodule foreach git pull origin master
install: update deploy
@exec $$SHELL
clean:
@echo 'Remove dot files in your home directory...'
@-$(foreach val, $(DOTFILES), rm -vrf $(HOME)/$(val);)
-rm -rf $(DOTPATH)