summary refs log tree commit diff
path: root/Makefile
blob: 8b5bf651b0360e3ab8bf86a3a430b32328fc1ac1 (plain) (blame)
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
INTO    = $(HOME)

INSTALL = \
	  bash_login \
	  bash_logout \
	  bashrc \
	  bin \
	  gitconfig \
	  gitignore \
	  tmux.conf \
	  vimrc

git:
	git config --local user.email "franckcuny@gmail.com"
	git config --local user.name "Franck Cuny"

INSTALLED = $(patsubst %,$(INTO)/.%,$(INSTALL))
LN        = @ln -sf

install: $(INSTALLED) $(HOME)/bin $(HOME)/src $(HOME)/tmp $(HOME)/.ssh/authorized_keys git

$(INTO)/.% : %
	@[ ! -e $@ ] || [ -h $@ ] || mv -f $@ $@.bak
	$(LN) $(PWD)/$< $@

$(HOME)/.ssh/authorized_keys:
	@curl https://github.com/franckcuny.keys -o $(HOME)/.ssh/authorized_keys

$(HOME)/bin:
	mkdir -p $(HOME)/bin

$(HOME)/src:
	mkdir -p $(HOME)/src

$(HOME)/tmp:
	mkdir -p $(HOME)/tmp

check-dead:
	@find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -print
	@find ~/bin -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -print

clean-dead:
	@find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -delete
	@find ~/bin -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -delete

.PHONY: install check-dead clean-dead git