diff options
author | Tom Willemse | 2013-04-14 23:58:45 +0200 |
---|---|---|
committer | Tom Willemse | 2013-04-14 23:58:45 +0200 |
commit | ea413a502373163f274bf3888563d2728cb1bf15 (patch) | |
tree | db454085e49ff7862a71d2814a56b70422d3b618 /dotfiles.mk | |
parent | 50c3f9ade9879e6dd0131a2efddcb14f46d920c5 (diff) | |
download | dotfiles-ea413a502373163f274bf3888563d2728cb1bf15.tar.gz dotfiles-ea413a502373163f274bf3888563d2728cb1bf15.zip |
Add uninstall targets
These targets can be used to remove (parts of) the file installation.
They are also used by the cleanup targets to remove complete
submodules from the installation.
Diffstat (limited to 'dotfiles.mk')
-rw-r--r-- | dotfiles.mk | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/dotfiles.mk b/dotfiles.mk index 8ca45fc..0a51b92 100644 --- a/dotfiles.mk +++ b/dotfiles.mk @@ -20,27 +20,33 @@ check-objects=$(addprefix check-,$(objects)) install-objects=$(addprefix install-,$(objects)) reverse-objects=$(addprefix reverse-,$(objects)) cleanup-objects=$(addprefix cleanup-,$(objects)) +uninstall-objects=$(addprefix uninstall-,$(objects)) check-modules=$(addprefix check-,$(modules)) install-modules=$(addprefix install-,$(modules)) reverse-modules=$(addprefix reverse-,$(modules)) cleanup-modules=$(addprefix cleanup-,$(modules)) +uninstall-modules=$(addprefix uninstall-,$(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) + $(reverse) $(reverse-objects) $(reverse-modules) \ + $(uninstall-objects) $(uninstall-modules) all: $(modules) $(objects) ifeq ($(MAKEROOT),y) check: $(check-modules) $(check-objects) install: cleanup $(install-modules) $(install-objects) Makefile.old reverse: $(reverse-modules) $(reverse-objects) +uninstall: $(uninstall-modules) $(uninstall-objects) + @rmdir --ignore-fail-on-non-empty $(DESTDIR) 2> /dev/null || true ifeq ($(firstword $(MAKEFILE_LIST)),Makefile.old) cleanup: $(cleanup-modules) $(cleanup-objects) @rmdir --ignore-fail-on-non-empty $(DESTDIR) 2> /dev/null || true else -cleanup: export NEWLIST = $(objects) +cleanup: export NEWOBJS = $(objects) +cleanup: export NEWMODS = $(modules) cleanup: @$(MAKE) -s -f Makefile.old cleanup @@ -60,6 +66,8 @@ reverse: @$(MAKE) -s -C ../ reverse cleanup: @$(MAKE) -s -C ../ cleanup +uninstall: + @$(MAKE) -s -C ../ uninstall endif $(modules): %: @@ -85,14 +93,16 @@ $(reverse-modules): reverse-%: @$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/ $(cleanup-objects): cleanup-%: - @$(if $(findstring $*,$(NEWLIST)),, \ + @$(if $(findstring $*,$(NEWOBJS)),, \ @$(if $(call older,$*), \ echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \ echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \ unlink "$(DESTDIR)/$*" || true)) $(cleanup-modules): cleanup-%: - @$(MAKE) -C $* cleanup MKDPREFIX=$(MKDPREFIX)$*/ + @$(if $(findstring $*,$(NEWMODS)), \ + @$(MAKE) -C $* cleanup MKDPREFIX=$(MKDPREFIX)$*/, \ + @$(MAKE) -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/) $(check-objects): check-%: @$(if $(call newer,$*), \ @@ -104,5 +114,14 @@ $(check-objects): check-%: $(check-modules): check-%: @$(MAKE) -s -C $* check MKDPREFIX=$(MKDPREFIX)$*/ +$(uninstall-objects): uninstall-%: + @$(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) -s -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/ + $(filter %.elc,$(objects)): %.elc: %.el $(call compile,$^) |