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 \ modules=awesome clfswm cower dunst fehlstart fish herbstluftwm \
newsbeuter zathura newsbeuter zathura

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/awesome SUBDIR=awesome
modules=themes modules=themes
objects=bowl.lua ext.lua infoline.lua keychain.lua oni.lua rc.lua 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 modules=custom
include ../../../dotfiles.mk include ../../../dotfiles.mk

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.conkerorrc SUBDIR=.conkerorrc
modules=themes styles modules=themes styles
objects=gtk2rc init.js ext_restore.js 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 objects=github.css help.css git-scm.css
include ../../dotfiles.mk include ../../dotfiles.mk

View file

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

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/naquadah SUBDIR=naquadah
objects=conkeror--scrollbars.css hints--url-panel.css minibuffer.css \ objects=conkeror--scrollbars.css hints--url-panel.css minibuffer.css \
mode-line.css new-tabs.css tab-bar.css theme.json 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 \ objects=conkeror--scrollbars.css hints--url-panel.css minibuffer.css \
mode-line.css new-tabs.css tab-bar.css theme.json 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 modules=share
include ../dotfiles.mk include ../dotfiles.mk

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/.zsh SUBDIR=.zsh
modules=functions modules=functions
include ../dotfiles.mk 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 \ objects=chpwd_show_todo chpwd_update_git_vars env get_cnt line \
precmd_maybe_festival precmd_update_git_vars precmd_update_updates \ precmd_maybe_festival precmd_update_git_vars precmd_update_updates \
preexec_update_vars prompt prompt_git_info rprompt \ preexec_update_vars prompt prompt_git_info rprompt \

View file

@ -34,9 +34,23 @@ all: $(modules) $(objects)
ifeq ($(MAKEROOT),y) ifeq ($(MAKEROOT),y)
check: $(check-modules) $(check-objects) check: $(check-modules) $(check-objects)
install: $(install-modules) $(install-objects) install: uninstall $(install-modules) $(install-objects) Makefile.old
reverse: $(reverse-modules) $(reverse-objects) reverse: $(reverse-modules) $(reverse-objects)
ifeq ($(firstword $(MAKEFILE_LIST)),Makefile.old)
uninstall: $(uninstall-modules) $(uninstall-objects) 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 else
check: check:
@$(MAKE) -s -C ../ check @$(MAKE) -s -C ../ check
@ -71,10 +85,11 @@ $(reverse-modules): reverse-%:
@$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/ @$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/
$(uninstall-objects): uninstall-%: $(uninstall-objects): uninstall-%:
@$(if $(findstring $*,$(NEWLIST)),, \
@$(if $(call older,$*), \ @$(if $(call older,$*), \
echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \ echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \
echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \ echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \
rm -f "$(DESTDIR)/$*") unlink "$(DESTDIR)/$*" || true))
$(uninstall-modules): uninstall-%: $(uninstall-modules): uninstall-%:
@$(MAKE) -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/ @$(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 objects=init.elc init.el gnus.elc gnus.el
modules=eshell site-lisp snippets modules=eshell site-lisp snippets

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/eshell SUBDIR=eshell
objects=alias objects=alias
modules= 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 \ objects=dzen.elc dzen.el eltuki.elc eltuki.el ext.elc ext.el \
metalexpress.elc metalexpress.el mu4e-init.elc mu4e-init.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 \ 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 modules=html-mode org-mode python-mode
include ../../dotfiles.mk include ../../dotfiles.mk

View file

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

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/org-mode SUBDIR=org-mode
objects=codeblock heading project snippet objects=codeblock heading project snippet
include ../../../dotfiles.mk 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 objects=defm_empty form form_valid import_from permission_guard url
include ../../../dotfiles.mk include ../../../dotfiles.mk