|
|
|
|
|
by matheusmoreira
262 days ago
|
|
> And if you introduce a new dotfile to the repo, you have to update the Makefile too. Not at all. The rules are generic. I can give make any path inside my home directory and it will try to match it against an equivalent file in the repository. $ make /home/matheus/.vimrc
ln -snf /home/matheus/.files/~/.vimrc /home/matheus/.vimrc
I only need to update the makefile if I want easy to use phony targets. These phony targets in turn simply depend on the paths to the real files which activate the generic rules I described in the article.It looks complicated because I used functions to compute all these paths from the items in the repository. Here's what the final result looks like: $ phony-targets GNUmakefile
git
/home/matheus/.config/git/config
mpv
/home/matheus/.config/mpv/mpv.conf
vim
/home/matheus/.vimrc
# ...
I could have used any of those paths and it would have worked. The phony targets are nice but not strictly needed.The bulk of the makefile is dealing with environment variables such as XDG_*_HOME and GNUPGHOME variables which affect where the links are supposed to end up. |
|