dotfiles/GNUmakefile
Tom Willemse 9b7417f6c6 Update GNUmakefile
- Add the ‘dunst’, ‘zsh’, ‘mcron’, and ‘mbsync’ modules.

- Tell Make that any ‘*.el’ files ar “precious”, meaning that when a ‘.elc’ file
  was generated from a ‘.el’ file that was itself generated from a ‘.org’ file,
  the ‘.el’ file isn't just an intermediate file and should not be deleted.

- Change the ‘install’ and ‘clean’ to use the ‘*-stow’ and ‘*-clean’ rules set
  up for each module.

- Add configuration for ‘outline-minor-mode’ and change the headings to adhere
  to that configuration.

- Stop using the ‘build/’ directory, tangle all the files to the same directory
  as the source files, and use stow, not cp, to install them. The only exception
  is the XDG files, which now have their specific ‘xdg-stow’ rule. This is
  necessary because programs using these files will overwrite a symbolic link
  they find and replace it with a new file, overwriting my settings.

- Add some files that were missing, and rename some files to follow the existing
  convention to make them easy to tangle.
2022-01-30 23:12:22 -08:00

143 lines
2.8 KiB
Makefile

MODULES=xmodmap emacs xdg shepherd dunst zsh mcron mbsync
STOW = stow
EMACS = emacs
SCHEME_IMPLEMENTATION = guile
.PRECIOUS: %.el
define tangle =
@echo -e "\e[35mOBT\e[0m" $<
@$(EMACS) -quick -batch \
-eval "(package-initialize)" \
-load ob-tangle \
-eval "(setq sh-make-vars-local nil)" \
-eval "(setq geiser-default-implementation '$(SCHEME_IMPLEMENTATION))" \
-eval "(org-babel-tangle-file \"$<\" \"$(PWD)/$@\" \"$(1)\")"
endef
.PHONY: all clean $(MODULES) zsh
all: $(MODULES)
install: $(addsuffix -stow,$(MODULES))
clean: $(addsuffix -clean,$(MODULES))
before-%-install: # Dummy recipe
@true
%-stow: % before-%-install
$(STOW) $<
%-install: %-stow # Dummy recipe
@true
%-uninstall:
$(STOW) -D $(subst -uninstall,,$@)
## Picom
picom: picom/.config/picom.conf
picom/.config/picom.conf: picom/.config/picom.org
$(call tangle,conf)
picom-clean:
rm -f picom/.config/picom.conf
## Emacs
emacs: emacs/.config/shepherd/init.d/emacs.scm emacs/.config/emacs/init.elc
emacs-clean:
rm -f emacs/.config/shepherd/init.d/emacs.scm emacs/.config/emacs/init.el \
emacs/.config/emacs/init.elc
## Xmodmap
xmodmap: xmodmap/.Xmodmap
xmodmap-clean:
rm -f xmodmap/.Xmodmap
## Cower
cower: cower/.config/cower/config
cower/.config/cower/config: cower/.config/cower/config.org
$(call tangle,conf-unix)
cower-clean:
rm -f cower/.config/cower/config
## Mowedline
mowedline: mowedline/.config/mowedline/init.scm
mowedline/.config/mowedline/init.scm: SCHEME_IMPLEMENTATION = chicken
mowedline/.config/mowedline/init.scm: mowedline/.config/mowedline/init.org
$(call tangle,scheme)
mowedline-clean:
rm -f mowedline/.config/mowedline/init.scm
## Dunst
dunst: dunst/.config/dunst/dunstrc
## X11
x11-install: lib-install x11/dot-x11-0-1-any.pkg.tar.xz
x11/dot-x11-0-1-any.pkg.tar.xz: x11/PKGBUILD
cd x11 && makepkg -sicf
## XDG
xdg: xdg/.config/mimeapps.list xdg/.config/user-dirs.dirs \
xdg/.config/user-dirs.locale
# These files shouldn't be stowed because the applications managing/using them
# immediately replace the symbolic links with new files and the settings in them
# are lost.
xdg-stow:
cp xdg/.config/mimeapps.list xdg/.config/user-dirs.dirs xdg/.config/user-dirs.locale $(HOME)/.config/
## Shepherd
shepherd: shepherd/.config/shepherd/init.scm
## Mcron
mcron: mcron/.config/shepherd/init.d/mcron.scm
## Mbsync
mbsync: mbsync/.config/cron/mbsync.guile
## ZSH
zsh: zsh/.profile zsh/.zshrc zsh/.zsh/functions/unzip.zwc \
zsh/.zsh/functions/x-yank.zwc zsh/.zsh/functions/x-copy-region-as-kill.zwc
## Helper
%.el: %.org
$(call tangle,emacs-lisp)
%.elc: %.el
@echo -e "\e[36mELC\e[0m" $<
$(EMACS) -batch -f package-initialize -f batch-byte-compile $<
%: %.org
$(call tangle)
.%: %.org
$(call tangle)
%.zwc: %
zsh -c "zcompile $@ $^"
# Local Variables:
# outline-regexp: "##+"
# End: