Tech News
← Back to articles

Managing Dotfiles with Make

read original related products more articles

Managing dotfiles with Make

Make is an old tool, an assembly language of sorts for build systems. Many have tried to replace it. Many have tried to reinvent it. Most people prefer to avoid it if at all possible. So why use it to manage dotfiles of all things?

There's at least one good reason to do this: make is ubiquitous. Pretty much every machine that has ever compiled software will have a copy of this thing. Using make as a dotfile management tool eliminates the need to install yet another infrequently used program.

Another reason to use it is this turned out to be a surprisingly easy task.

File system structure

Make works best when everything is as simple as possible. It doesn't provide much functionality: the few path manipulation functions it includes are of the string matching and substitution variety.

The easiest way to achieve that simplicity is to mirror the structure of the home directory. Like this:

~/.files ~ .bash_profile .bashrc .vimrc ... GNUmakefile

The ~ directory represents the current user's home directory. Configuration files in $HOME will be symbolic links to their corresponding files in the ~ directory of the repository. Make's job is to automatically create those symbolic links.

... continue reading