-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (78 loc) · 2.61 KB
/
Makefile
File metadata and controls
105 lines (78 loc) · 2.61 KB
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
##########
# CONSTS #
##########
DOTFILELIST :=
DOTFILELIST += .bin
DOTFILELIST += .hints
DOTFILELIST += .i3 .i3status.conf
DOTFILELIST += .vimrc .vim
DOTFILELIST += .local/share/applications/mimeapps.list
DOTFILELIST += .gitconfig
DOTFILELIST += .bashrc .profile .Xresources .xsession
DOTFILELIST += .fonts.conf
DOTFILELIST += .icons .themes .gtkrc-2.0
DOTFILELIST += .pulse/client.conf .pulse/daemon.conf .pulse/default.pa
DOTFILELIST += .config/dunst/dunstrc
DOTFILELIST += .config/gtk-3.0/settings.ini
DOTFILELIST += .config/mpv/mpv.conf
DOTFILELIST += .surf
DOTFILELIST += .ssh/config
ICONS_REMOTEADDR := https://github.com/mlnlbrt/paper-icon-theme/trunk/Paper
#############
# VARIABLES #
#############
BACKUPNAME := $(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
HOMEDIR := $(shell echo ~)
BACKUPDIR := $(PWD)/.backup/$(BACKUPNAME)
PACKAGEDIR := $(PWD)
VIMDIR := $(addprefix $(HOMEDIR)/, .vim)
THEMESDIR := $(addprefix $(HOMEDIR)/, .themes)
ICONSDIR := $(addprefix $(HOMEDIR)/, .icons)
BACKUP_DOTFILES := $(addprefix $(BACKUPDIR)/, $(DOTFILELIST))
TARGET_DOTFILES := $(addprefix $(HOMEDIR)/, $(DOTFILELIST))
###########
# TARGETS #
###########
.PHONY: all \
backup clean install \
installsymlinks installvimplugins installicons \
update gitupdate
all: backup clean install
backup: $(BACKUP_DOTFILES)
@echo "Saved the user's dotfiles backup to" $(BACKUPDIR)
clean:
@rm -rf $(TARGET_DOTFILES)
@rmdir -p $(filter-out $(HOMEDIR)/, $(dir $(TARGET_DOTFILES))) 2> /dev/null || true
install: installsymlinks installvimplugins installicons
installsymlinks: $(TARGET_DOTFILES)
installvimplugins: $(VIMDIR)/bundle/Vundle.vim $(VIMDIR)/.pluginsinstalled
installicons: $(ICONSDIR)/.iconsinstalled
update: clean gitupdate install
gitupdate:
@git fetch origin
@git reset --hard origin/master
#########
# RULES #
#########
# How to make backup of the user's particular dotfiles
# which are affected by the package
$(BACKUP_DOTFILES):
@mkdir -p $(dir $@)
@cp -Lr $(addprefix $(HOMEDIR)/, $(subst $(BACKUPDIR)/,,$@)) $@ 2> /dev/null || true
# How to make symlinks in the user's /home directory
$(TARGET_DOTFILES):
@mkdir -p $(dir $@)
@ln -s $(addprefix $(PACKAGEDIR)/, $(subst $(HOMEDIR)/,,$@)) $@
# Get Vim's Vundle
$(VIMDIR)/bundle/Vundle.vim:
@git clone https://github.com/VundleVim/Vundle.vim.git $@
# Install Vim's plugins
# It's assumed that the successful installation of Vim's plugins
# is confirmed by the dotfile created below
$(VIMDIR)/.pluginsinstalled:
@vim +PluginInstall +qall
@touch $@
# Install icons
$(ICONSDIR)/.iconsinstalled:
@svn export $(ICONS_REMOTEADDR) $(ICONSDIR)/Paper
@touch $@