DOTFILES_PATH is derived from the current working directory, not from the location of the
Makefile, so invoking make from elsewhere points 25 symlinks at a directory that does not exist.
Evidence
Makefile:10-11:
# DOTFILES_PATH should be ~/.dotfiles when installed normally
DOTFILES_PATH:=$(shell pwd)
The comment states the assumption and does not enforce it. DOTFILES_PATH is the source side of
every link rule — Makefile:122, 147, 320, 353-357, 365, 373-379, 384-392, 402-411,
470, 519-521, 662, 664, 689, 695, 706, 717.
make -C ~/.dotfiles all is safe: make changes directory before reading anything, so pwd is
correct.
make -f ~/.dotfiles/Makefile all from any other directory is not: pwd is the caller's
directory, and every ln -s points there.
The second form is exactly what a script would write, and #61 proposes adding a make
invocation to scripts/upgrade — so this becomes reachable the moment that lands, if -C is
forgotten.
Fix
Derive it from the makefile itself, which is correct under every invocation:
DOTFILES_PATH:=$(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
$(lastword $(MAKEFILE_LIST)) must be read at the top of the file, before any include, which is
where the current line already sits.
Verification
cd /tmp && make -f ~/.dotfiles/Makefile -n ~/.tmux.conf
must print a ln -s whose source is ~/.dotfiles/tmux/.tmux.conf, not /tmp/tmux/.tmux.conf.
DOTFILES_PATHis derived from the current working directory, not from the location of theMakefile, so invoking make from elsewhere points 25 symlinks at a directory that does not exist.Evidence
Makefile:10-11:The comment states the assumption and does not enforce it.
DOTFILES_PATHis the source side ofevery link rule —
Makefile:122,147,320,353-357,365,373-379,384-392,402-411,470,519-521,662,664,689,695,706,717.make -C ~/.dotfiles allis safe: make changes directory before reading anything, sopwdiscorrect.
make -f ~/.dotfiles/Makefile allfrom any other directory is not:pwdis the caller'sdirectory, and every
ln -spoints there.The second form is exactly what a script would write, and #61 proposes adding a make
invocation to
scripts/upgrade— so this becomes reachable the moment that lands, if-Cisforgotten.
Fix
Derive it from the makefile itself, which is correct under every invocation:
$(lastword $(MAKEFILE_LIST))must be read at the top of the file, before anyinclude, which iswhere the current line already sits.
Verification
must print a
ln -swhose source is~/.dotfiles/tmux/.tmux.conf, not/tmp/tmux/.tmux.conf.