diff --git a/dotfiles.mk b/dotfiles.mk index b7bd5c6..8ca45fc 100644 --- a/dotfiles.mk +++ b/dotfiles.mk @@ -19,30 +19,30 @@ endef check-objects=$(addprefix check-,$(objects)) install-objects=$(addprefix install-,$(objects)) reverse-objects=$(addprefix reverse-,$(objects)) -uninstall-objects=$(addprefix uninstall-,$(objects)) +cleanup-objects=$(addprefix cleanup-,$(objects)) check-modules=$(addprefix check-,$(modules)) install-modules=$(addprefix install-,$(modules)) reverse-modules=$(addprefix reverse-,$(modules)) -uninstall-modules=$(addprefix uninstall-,$(modules)) +cleanup-modules=$(addprefix cleanup-,$(modules)) -.PHONY: all install uninstall check uninstall $(modules) \ - $(install-objects) $(uninstall-objects) $(check-objects) \ - $(install-modules) $(uninstall-modules) $(check-modules) \ +.PHONY: all install cleanup check cleanup $(modules) \ + $(install-objects) $(cleanup-objects) $(check-objects) \ + $(install-modules) $(cleanup-modules) $(check-modules) \ $(reverse) $(reverse-objects) $(reverse-modules) all: $(modules) $(objects) ifeq ($(MAKEROOT),y) check: $(check-modules) $(check-objects) -install: uninstall $(install-modules) $(install-objects) Makefile.old +install: cleanup $(install-modules) $(install-objects) Makefile.old reverse: $(reverse-modules) $(reverse-objects) ifeq ($(firstword $(MAKEFILE_LIST)),Makefile.old) -uninstall: $(uninstall-modules) $(uninstall-objects) +cleanup: $(cleanup-modules) $(cleanup-objects) @rmdir --ignore-fail-on-non-empty $(DESTDIR) 2> /dev/null || true else -uninstall: export NEWLIST = $(objects) -uninstall: - @$(MAKE) -s -f Makefile.old uninstall +cleanup: export NEWLIST = $(objects) +cleanup: + @$(MAKE) -s -f Makefile.old cleanup Makefile.old: $(firstword $(MAKEFILE_LIST)) @cp "$^" "$@" @@ -58,8 +58,8 @@ install: @$(MAKE) -s -C ../ install reverse: @$(MAKE) -s -C ../ reverse -uninstall: - @$(MAKE) -s -C ../ uninstall +cleanup: + @$(MAKE) -s -C ../ cleanup endif $(modules): %: @@ -84,15 +84,15 @@ $(reverse-objects): reverse-%: $(reverse-modules): reverse-%: @$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/ -$(uninstall-objects): uninstall-%: +$(cleanup-objects): cleanup-%: @$(if $(findstring $*,$(NEWLIST)),, \ @$(if $(call older,$*), \ echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \ echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \ unlink "$(DESTDIR)/$*" || true)) -$(uninstall-modules): uninstall-%: - @$(MAKE) -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/ +$(cleanup-modules): cleanup-%: + @$(MAKE) -C $* cleanup MKDPREFIX=$(MKDPREFIX)$*/ $(check-objects): check-%: @$(if $(call newer,$*), \