dotfiles/GNUmakefile

171 lines
3.6 KiB
Text
Raw Normal View History

MODULES=xmodmap emacs xdg shepherd dunst zsh mcron mbsync nyxt work \
herbstluftwm mpd polybar xbindkeys firefox
STOW = stow
EMACS = emacs
SCHEME_IMPLEMENTATION = guile
# Found this sed command here: https://stackoverflow.com/a/40778047
FIREFOX_PROFILE := $(shell sed -nr "/^Name=default/ { :l /^Path=/ { s/[^=]*=[ ]*//; p; q; }; n; b l; }" ~/.mozilla/firefox/profiles.ini 2>/dev/null)
.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
2017-04-03 05:22:36 +02:00
.PHONY: all clean $(MODULES) zsh
all: $(MODULES)
install: $(addsuffix -stow,$(MODULES))
clean: $(addsuffix -clean,$(MODULES))
2017-04-03 05:22:36 +02:00
before-%-install: # Dummy recipe
@true
%-stow: % before-%-install
$(STOW) $<
2020-04-25 05:49:40 +02:00
%-install: %-stow # Dummy recipe
@true
2020-04-25 05:49:40 +02:00
%-uninstall:
$(STOW) -D $(subst -uninstall,,$@)
2018-01-09 06:16:02 +01:00
## Picom
2017-06-22 09:07:28 +02:00
picom: picom/.config/picom.conf
2017-06-22 09:07:28 +02:00
picom/.config/picom.conf: picom/.config/picom.org
2017-06-22 09:07:28 +02:00
$(call tangle,conf)
picom-clean:
rm -f picom/.config/picom.conf
2017-06-22 09:07:28 +02:00
## 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
2017-04-03 05:22:36 +02:00
## Xmodmap
2017-04-03 05:22:36 +02:00
xmodmap: xmodmap/.Xmodmap
2017-04-03 05:22:36 +02:00
xmodmap-clean:
rm -f xmodmap/.Xmodmap
2017-04-03 05:22:36 +02:00
## Cower
2018-01-09 05:48:18 +01:00
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
2018-01-09 06:21:01 +01:00
## Mowedline
2018-01-09 06:21:01 +01:00
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
2018-01-09 07:33:43 +01:00
## Dunst
2018-01-09 07:33:43 +01:00
dunst: dunst/.config/dunst/dunstrc dunst/.config/shepherd/init.d/dunst.scm
2018-01-09 07:33:43 +01:00
## 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
2022-01-31 09:51:03 +01:00
## Nyxt
nyxt: nyxt/.config/nyxt/init.lisp
## Firefox
ifneq ($(FIREFOX_PROFILE),)
firefox: firefox/.mozilla/firefox/$(FIREFOX_PROFILE)/chrome/userChrome.css
firefox/.mozilla/firefox/$(FIREFOX_PROFILE)/chrome/userChrome.css: firefox/src/userChrome.css
mkdir -p $$(dirname $@)
cp $^ $@
else
firefox:
@echo "Error finding firefox default profile, can't make" >&2
firefox-stow:
@echo "Error finding firefox default profile, can't stow" >&2
endif
## 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 $@ $^"
check:
$(SCHEME_IMPLEMENTATION) --no-auto-compile test.scm
2024-11-23 08:42:12 +01:00
new-dotfiles:
# Local Variables:
# outline-regexp: "##+"
# End: