diff options
Diffstat (limited to '.config/Makefile')
-rw-r--r-- | .config/Makefile | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/.config/Makefile b/.config/Makefile index 3b7ebb1..62c639e 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -7,11 +7,12 @@ else SHELL = /bin/bash -o pipefail GIT_DIR = ${HOME}/.git +STATEDIR = ${XDG_CACHE_HOME}/config targets = \ ${GIT_DIR}/info/exclude \ - ${XDG_CACHE_HOME}/config-symlinks/cookie \ - $(if $(shell crontab -l),${XDG_CACHE_HOME}/cron/cookie) \ + ${STATEDIR}/symlinks.stamp \ + $(if $(shell crontab -l),${STATEDIR}/crontab.stamp) \ $(if $(wildcard ${HOME}/Maildir),${HOME}/.folders) \ $(if $(wildcard ${XDG_CONFIG_HOME}/dconf/user),${XDG_CONFIG_HOME}/dconf/user.txt) @@ -20,20 +21,32 @@ clean: rm -f -- $(targets) .PHONY: all clean -${HOME}/.folders: ${HOME}/Maildir $(MAKEFILE_LIST) - find -L $< -mindepth 2 -maxdepth 2 \( -type f -name "maildirfolder" -o -type d -name new -o -type d -name tmp -o -type d -name cur \) -printf '%P\0' | xargs -r0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' > '$@' +ifneq ($(wildcard ${HOME}/Maildir),) +MAILDIRS = . +-include ${STATEDIR}/maildirs.mk +${HOME}/.folders: $(addprefix ${HOME}/Maildir/,${MAILDIRS}) + find -L $< \( -false \ + -o -type f -name maildirfolder \ + -o -type d -name new \ + -o -type d -name tmp \ + -o -type d -name cur \ + \) -printf '%P\0' | xargs -r0 dirname -z -- | sort -zu | xargs -0 printf -- '.%s\n' > '$@' +${STATEDIR}/maildirs.mk: ${HOME}/.folders + < $< sed -n 's/^\.//p' | xargs -d $$'\n' -r dirname -- | sort -u | xargs -d $$'\n' -r printf 'MAILDIRS += %s\n' > $@ +endif + ${GIT_DIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ ${XDG_CONFIG_HOME}/dconf/user.txt: ${XDG_CONFIG_HOME}/dconf/user dconf dump / > $@ -${XDG_CACHE_HOME}/cron/cookie: ${XDG_CONFIG_HOME}/cron +${STATEDIR}/crontab.stamp: ${XDG_CONFIG_HOME}/cron -(cat $^/*; echo) | crontab - 2>/dev/null mkdir -p '$(@D)' date > '$@' -${XDG_CACHE_HOME}/config-symlinks/cookie: ${XDG_CONFIG_HOME}/symlinks +${STATEDIR}/symlinks.stamp: ${XDG_CONFIG_HOME}/symlinks config-symlinks mkdir -p '$(@D)' date > '$@' |