diff --git a/.config/Makefile b/.config/Makefile index 0d9939f..3407f57 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.config +SUBDIR=.config modules=awesome clfswm cower dunst fehlstart fish herbstluftwm \ newsbeuter zathura diff --git a/.config/awesome/Makefile b/.config/awesome/Makefile index bec3818..071a7ad 100644 --- a/.config/awesome/Makefile +++ b/.config/awesome/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/awesome +SUBDIR=awesome modules=themes objects=bowl.lua ext.lua infoline.lua keychain.lua oni.lua rc.lua diff --git a/.config/awesome/themes/Makefile b/.config/awesome/themes/Makefile index 85298f3..2c32a7e 100644 --- a/.config/awesome/themes/Makefile +++ b/.config/awesome/themes/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/themes +SUBDIR=themes modules=custom include ../../../dotfiles.mk diff --git a/.config/awesome/themes/custom/Makefile b/.config/awesome/themes/custom/Makefile index 8cebe3d..c5e3982 100644 --- a/.config/awesome/themes/custom/Makefile +++ b/.config/awesome/themes/custom/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/custom +SUBDIR=custom objects=theme.lua include ../../../../dotfiles.mk diff --git a/.config/clfswm/Makefile b/.config/clfswm/Makefile index d79241a..974bea3 100644 --- a/.config/clfswm/Makefile +++ b/.config/clfswm/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/clfswm +SUBDIR=clfswm objects=clfswmrc include ../../dotfiles.mk diff --git a/.config/cower/Makefile b/.config/cower/Makefile index 8828ad3..c7765dc 100644 --- a/.config/cower/Makefile +++ b/.config/cower/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/cower +SUBDIR=cower objects=config include ../../dotfiles.mk diff --git a/.config/dunst/Makefile b/.config/dunst/Makefile index 4f8a4e5..6076e74 100644 --- a/.config/dunst/Makefile +++ b/.config/dunst/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/dunst +SUBDIR=dunst objects=dunstrc include ../../dotfiles.mk diff --git a/.config/fehlstart/Makefile b/.config/fehlstart/Makefile index 303a9ca..0c6998d 100644 --- a/.config/fehlstart/Makefile +++ b/.config/fehlstart/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/fehlstart +SUBDIR=fehlstart objects=fehlstart.rc include ../../dotfiles.mk diff --git a/.config/fish/Makefile b/.config/fish/Makefile index 2b32c1b..cdce7a6 100644 --- a/.config/fish/Makefile +++ b/.config/fish/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/fish +SUBDIR=fish objects=config.fish include ../../dotfiles.mk diff --git a/.config/herbstluftwm/Makefile b/.config/herbstluftwm/Makefile index 62151ad..e8f232f 100644 --- a/.config/herbstluftwm/Makefile +++ b/.config/herbstluftwm/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/herbstluftwm +SUBDIR=herbstluftwm objects=autostart panel.sh include ../../dotfiles.mk diff --git a/.config/newsbeuter/Makefile b/.config/newsbeuter/Makefile index fbf22de..df228e9 100644 --- a/.config/newsbeuter/Makefile +++ b/.config/newsbeuter/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/newsbeuter +SUBDIR=newsbeuter objects=config urls include ../../dotfiles.mk diff --git a/.config/zathura/Makefile b/.config/zathura/Makefile index c6c93c1..b076c74 100644 --- a/.config/zathura/Makefile +++ b/.config/zathura/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/zathura +SUBDIR=zathura objects=zathurarc include ../../dotfiles.mk diff --git a/.conkerorrc/Makefile b/.conkerorrc/Makefile index 8161f39..be7ee27 100644 --- a/.conkerorrc/Makefile +++ b/.conkerorrc/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.conkerorrc +SUBDIR=.conkerorrc modules=themes styles objects=gtk2rc init.js ext_restore.js diff --git a/.conkerorrc/styles/Makefile b/.conkerorrc/styles/Makefile index c75377b..14ecaaa 100644 --- a/.conkerorrc/styles/Makefile +++ b/.conkerorrc/styles/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/styles +SUBDIR=styles objects=github.css help.css git-scm.css include ../../dotfiles.mk diff --git a/.conkerorrc/themes/Makefile b/.conkerorrc/themes/Makefile index adb917a..6e95dc4 100644 --- a/.conkerorrc/themes/Makefile +++ b/.conkerorrc/themes/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/themes +SUBDIR=themes modules=naquadah yoshi include ../../dotfiles.mk diff --git a/.conkerorrc/themes/naquadah/Makefile b/.conkerorrc/themes/naquadah/Makefile index 0512339..6a1634a 100644 --- a/.conkerorrc/themes/naquadah/Makefile +++ b/.conkerorrc/themes/naquadah/Makefile @@ -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 diff --git a/.conkerorrc/themes/yoshi/Makefile b/.conkerorrc/themes/yoshi/Makefile index 158dade..1c5bb94 100644 --- a/.conkerorrc/themes/yoshi/Makefile +++ b/.conkerorrc/themes/yoshi/Makefile @@ -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 diff --git a/.gitignore b/.gitignore index e69de29..6dc3062 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +Makefile.old diff --git a/.local/Makefile b/.local/Makefile index 4b1a1cf..a473a83 100644 --- a/.local/Makefile +++ b/.local/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.local +SUBDIR=.local modules=share include ../dotfiles.mk diff --git a/.local/share/Makefile b/.local/share/Makefile index c06880a..da723ff 100644 --- a/.local/share/Makefile +++ b/.local/share/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/share +SUBDIR=share modules=applications include ../../dotfiles.mk diff --git a/.local/share/applications/Makefile b/.local/share/applications/Makefile index 3d2ca22..4fb9a44 100644 --- a/.local/share/applications/Makefile +++ b/.local/share/applications/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/applications +SUBDIR=applications objects=moc.desktop ncmpcpp.desktop poweroff.desktop reboot.desktop include ../../../dotfiles.mk diff --git a/.moc/Makefile b/.moc/Makefile index 5eb4fa2..ec1b2b7 100644 --- a/.moc/Makefile +++ b/.moc/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.moc +SUBDIR=.moc modules=themes objects=config diff --git a/.moc/themes/Makefile b/.moc/themes/Makefile index fd61c62..77c8f1f 100644 --- a/.moc/themes/Makefile +++ b/.moc/themes/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/themes +SUBDIR=themes objects=custom include ../../dotfiles.mk diff --git a/.mutt/Makefile b/.mutt/Makefile index d1e65d1..ba059f1 100644 --- a/.mutt/Makefile +++ b/.mutt/Makefile @@ -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 diff --git a/.ncmpcpp/Makefile b/.ncmpcpp/Makefile index 728f643..059c96b 100644 --- a/.ncmpcpp/Makefile +++ b/.ncmpcpp/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.ncmpcpp +SUBDIR=.ncmpcpp objects=config include ../dotfiles.mk diff --git a/.pentadactyl/Makefile b/.pentadactyl/Makefile index e0640d2..6c3ac5c 100644 --- a/.pentadactyl/Makefile +++ b/.pentadactyl/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.pentadactyl +SUBDIR=.pentadactyl modules=plugins include ../dotfiles.mk diff --git a/.pentadactyl/plugins/Makefile b/.pentadactyl/plugins/Makefile index 8ed9478..badaa01 100644 --- a/.pentadactyl/plugins/Makefile +++ b/.pentadactyl/plugins/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/plugins +SUBDIR=plugins objects=emacs.penta include ../../dotfiles.mk diff --git a/.sawfish/Makefile b/.sawfish/Makefile index b680366..842bb1a 100644 --- a/.sawfish/Makefile +++ b/.sawfish/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.sawfish +SUBDIR=.sawfish objects=rc include ../dotfiles.mk diff --git a/.ssh/Makefile b/.ssh/Makefile index 2461e6c..b805834 100644 --- a/.ssh/Makefile +++ b/.ssh/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.ssh +SUBDIR=.ssh objects=config include ../dotfiles.mk diff --git a/.w3m/Makefile b/.w3m/Makefile index 85d09d5..ba96315 100644 --- a/.w3m/Makefile +++ b/.w3m/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.w3m +SUBDIR=.w3m objects=config include ../dotfiles.mk diff --git a/.weechat/Makefile b/.weechat/Makefile index 8a0618a..6f81768 100644 --- a/.weechat/Makefile +++ b/.weechat/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.weechat +SUBDIR=.weechat objects=alias.conf irc.conf weechat.conf include ../dotfiles.mk diff --git a/.zsh/Makefile b/.zsh/Makefile index 077367e..acd5e4e 100644 --- a/.zsh/Makefile +++ b/.zsh/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/.zsh +SUBDIR=.zsh modules=functions include ../dotfiles.mk diff --git a/.zsh/functions/Makefile b/.zsh/functions/Makefile index baf5c6b..d410977 100644 --- a/.zsh/functions/Makefile +++ b/.zsh/functions/Makefile @@ -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 \ diff --git a/dotfiles.mk b/dotfiles.mk index 892c5b5..b7bd5c6 100644 --- a/dotfiles.mk +++ b/dotfiles.mk @@ -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 $(call older,$*), \ - echo -e "$(FG_RED)+ $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \ - echo -e "$(FG_GRE)- $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \ - rm -f "$(DESTDIR)/$*") + @$(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)$*/ diff --git a/emacs/Makefile b/emacs/Makefile index 43ee5ec..5f8d204 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -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 diff --git a/emacs/eshell/Makefile b/emacs/eshell/Makefile index fd3b0f2..3b6ce2f 100644 --- a/emacs/eshell/Makefile +++ b/emacs/eshell/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/eshell +SUBDIR=eshell objects=alias modules= diff --git a/emacs/site-lisp/Makefile b/emacs/site-lisp/Makefile index bf452e9..91ee32e 100644 --- a/emacs/site-lisp/Makefile +++ b/emacs/site-lisp/Makefile @@ -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 \ diff --git a/emacs/snippets/Makefile b/emacs/snippets/Makefile index 12ff544..e003ed3 100644 --- a/emacs/snippets/Makefile +++ b/emacs/snippets/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/snippets +SUBDIR=snippets modules=html-mode org-mode python-mode include ../../dotfiles.mk diff --git a/emacs/snippets/html-mode/Makefile b/emacs/snippets/html-mode/Makefile index b2dff78..2d6defe 100644 --- a/emacs/snippets/html-mode/Makefile +++ b/emacs/snippets/html-mode/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/html-mode +SUBDIR=html-mode objects=for generic-block include ../../../dotfiles.mk diff --git a/emacs/snippets/org-mode/Makefile b/emacs/snippets/org-mode/Makefile index 34d4cd9..670b139 100644 --- a/emacs/snippets/org-mode/Makefile +++ b/emacs/snippets/org-mode/Makefile @@ -1,4 +1,4 @@ -DESTDIR:=$(DESTDIR)/org-mode +SUBDIR=org-mode objects=codeblock heading project snippet include ../../../dotfiles.mk diff --git a/emacs/snippets/python-mode/Makefile b/emacs/snippets/python-mode/Makefile index 192657b..8e8b652 100644 --- a/emacs/snippets/python-mode/Makefile +++ b/emacs/snippets/python-mode/Makefile @@ -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