Have the install command uninstall first

The new uninstall functionality tries to remove any "orphan" files.
Files that were installed during the last install, but will not be
installed this time (because of removal, not necessity).
This commit is contained in:
Tom Willemse 2013-04-14 01:03:11 +02:00
parent 9ab70194a6
commit d8aa1d0ed1
41 changed files with 60 additions and 44 deletions

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.config
SUBDIR=.config
modules=awesome clfswm cower dunst fehlstart fish herbstluftwm \
newsbeuter zathura

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/awesome
SUBDIR=awesome
modules=themes
objects=bowl.lua ext.lua infoline.lua keychain.lua oni.lua rc.lua

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/themes
SUBDIR=themes
modules=custom
include ../../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/custom
SUBDIR=custom
objects=theme.lua
include ../../../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/clfswm
SUBDIR=clfswm
objects=clfswmrc
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/cower
SUBDIR=cower
objects=config
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/dunst
SUBDIR=dunst
objects=dunstrc
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/fehlstart
SUBDIR=fehlstart
objects=fehlstart.rc
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/fish
SUBDIR=fish
objects=config.fish
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/herbstluftwm
SUBDIR=herbstluftwm
objects=autostart panel.sh
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/newsbeuter
SUBDIR=newsbeuter
objects=config urls
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/zathura
SUBDIR=zathura
objects=zathurarc
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.conkerorrc
SUBDIR=.conkerorrc
modules=themes styles
objects=gtk2rc init.js ext_restore.js

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/styles
SUBDIR=styles
objects=github.css help.css git-scm.css
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/themes
SUBDIR=themes
modules=naquadah yoshi
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/naquadah
SUBDIR=naquadah
objects=conkeror--scrollbars.css hints--url-panel.css minibuffer.css \
mode-line.css new-tabs.css tab-bar.css theme.json

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/yoshi
SUBDIR=yoshi
objects=conkeror--scrollbars.css hints--url-panel.css minibuffer.css \
mode-line.css new-tabs.css tab-bar.css theme.json

1
.gitignore vendored
View file

@ -0,0 +1 @@
Makefile.old

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.local
SUBDIR=.local
modules=share
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/share
SUBDIR=share
modules=applications
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/applications
SUBDIR=applications
objects=moc.desktop ncmpcpp.desktop poweroff.desktop reboot.desktop
include ../../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.moc
SUBDIR=.moc
modules=themes
objects=config

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/themes
SUBDIR=themes
objects=custom
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.mutt
SUBDIR=.mutt
objects=aethon.muttrc arch.muttrc colors.muttrc gmail.muttrc \
iactor.muttrc macros mailcap muttrc ninthfloor.muttrc \
ryuslash.org.muttrc sig

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.ncmpcpp
SUBDIR=.ncmpcpp
objects=config
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.pentadactyl
SUBDIR=.pentadactyl
modules=plugins
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/plugins
SUBDIR=plugins
objects=emacs.penta
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.sawfish
SUBDIR=.sawfish
objects=rc
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.ssh
SUBDIR=.ssh
objects=config
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.w3m
SUBDIR=.w3m
objects=config
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.weechat
SUBDIR=.weechat
objects=alias.conf irc.conf weechat.conf
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.zsh
SUBDIR=.zsh
modules=functions
include ../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/functions
SUBDIR=functions
objects=chpwd_show_todo chpwd_update_git_vars env get_cnt line \
precmd_maybe_festival precmd_update_git_vars precmd_update_updates \
preexec_update_vars prompt prompt_git_info rprompt \

View file

@ -34,9 +34,23 @@ all: $(modules) $(objects)
ifeq ($(MAKEROOT),y)
check: $(check-modules) $(check-objects)
install: $(install-modules) $(install-objects)
install: uninstall $(install-modules) $(install-objects) Makefile.old
reverse: $(reverse-modules) $(reverse-objects)
ifeq ($(firstword $(MAKEFILE_LIST)),Makefile.old)
uninstall: $(uninstall-modules) $(uninstall-objects)
@rmdir --ignore-fail-on-non-empty $(DESTDIR) 2> /dev/null || true
else
uninstall: export NEWLIST = $(objects)
uninstall:
@$(MAKE) -s -f Makefile.old uninstall
Makefile.old: $(firstword $(MAKEFILE_LIST))
@cp "$^" "$@"
ifdef SUBDIR
DESTDIR:=$(DESTDIR)/$(SUBDIR)
endif
endif
else
check:
@$(MAKE) -s -C ../ check
@ -71,10 +85,11 @@ $(reverse-modules): reverse-%:
@$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/
$(uninstall-objects): uninstall-%:
@$(if $(findstring $*,$(NEWLIST)),, \
@$(if $(call older,$*), \
echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \
echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \
rm -f "$(DESTDIR)/$*")
unlink "$(DESTDIR)/$*" || true))
$(uninstall-modules): uninstall-%:
@$(MAKE) -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.emacs.d
SUBDIR=.emacs.d
objects=init.elc init.el gnus.elc gnus.el
modules=eshell site-lisp snippets

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/eshell
SUBDIR=eshell
objects=alias
modules=

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/site-lisp
SUBDIR=site-lisp
objects=dzen.elc dzen.el eltuki.elc eltuki.el ext.elc ext.el \
metalexpress.elc metalexpress.el mu4e-init.elc mu4e-init.el \
oni.elc oni.el org-init.elc org-init.el quick-edit-mode.elc \

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/snippets
SUBDIR=snippets
modules=html-mode org-mode python-mode
include ../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/html-mode
SUBDIR=html-mode
objects=for generic-block
include ../../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/org-mode
SUBDIR=org-mode
objects=codeblock heading project snippet
include ../../../dotfiles.mk

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/python-mode
SUBDIR=python-mode
objects=defm_empty form form_valid import_from permission_guard url
include ../../../dotfiles.mk