dotfiles/emacs/makefile

50 lines
1.2 KiB
Makefile

# -*- mode: makefile-gmake; -*-
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
EMACSD := ~/.emacs.d
# Doom Config
DOOMD := ~/.doom.d
DOOM_URL := https://github.com/hlissner/doom-emacs
include ../lib/shared.mk
install: | init update
init:
if (( ! $$+commands[emacs] )) ; then
$(report) debug "Emacs not installed. Skipping install."
elif [[ -v $$SSH_TTY ]] ; then
$(report) debug "This is a SSH connection. Skipping."
else
$(report) header "emacs init"
$(mk_link) $(SRC_DIR) $(DOOMD)
$(MAKE) -C $(SRC_DIR) doom_init
fi
doom_init:
if [ ! -e $(EMACSD) ] ; then
git clone $(DOOM_URL) $(EMACSD)
~/.emacs.d/bin/doom --yes install \
; $(report) "doom install"
~/.emacs.d/bin/doom --yes compile ':core' \
; $(report) "doom core compile"
else
$(report) debug "emacsd already exists. Skipping"
fi
update:
if [ -e $(EMACSD)/bin/doom ] ; then
~/.emacs.d/bin/doom --yes purge \
; $(report) "doom purge"
~/.emacs.d/bin/doom --yes sync \
; $(report) "doom sync"
else
$(report) debug "doom not setup, so not updating."
fi
remove:
$(report) header "Removing Emacs configuration"
rm -rf $(EMACSD) ; $(report) "deleted $(EMACSD)"
$(rm_link) $(DOOMD)