dotfiles/emacs/makefile
James Patrick eaed9d80df Added support for both DOOM and Spacemacs
To use one or the other specify set variable to either `doom` or
`spacemacs`. If no value is specified it will default to Spacemacs,
though this may change in the future.
2019-08-04 20:41:05 -04:00

67 lines
1.8 KiB
Makefile

SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
EMACSD := ~/.emacs.d
FRAMEWORK := ${EMACS_FRAMEWORK}
# Doom Config
DOOMD := ~/.doom.d
DOOM_URL := https://github.com/hlissner/doom-emacs
# Spacemacs config
SPACEMACSD := ~/.spacemacs.d
SPACEMACS_URL := https://github.com/syl20bnr/spacemacs
include ../lib/shared.mk
install: | init update
init:
ifndef IS_SSH
$(info Remote connection. Not installing emacs config.)
else ifneq ($(call cmd_exist,emacs), true)
$(info Emacs not installed )
else ifeq ($(FRAMEWORK), doom)
$(info => installing doom.)
$(MAKE) -C $(SRC_DIR) doom_init
$(mk_link) $(SRC_DIR)/doom.d $(DOOMD)
else
$(info => installing spacemacs.)
$(MAKE) -C $(SRC_DIR) spacemacs_init
$(mk_link) $(SRC_DIR) $(SPACEMACSD)
endif
doom_init:
ifeq ($(shell [ ! -e $(EMACSD) ] $(return_val_truthy) ), true)
git clone $(DOOM_URL) $(EMACSD) ; $(report) "Doom installed"
$(report) warn "Doom quickstart is about to start. This will take a minute" ; sleep 3
~/.emacs.d/bin/doom --yes quickstart
~/.emacs.d/bin/doom --yes compile ':core'
else
$(report) info "$(EMACSD) already exist. Skipping."
endif
spacemacs_init:
ifeq ($(shell [ ! -e $(EMACSD) ] $(return_val_truthy) ), true)
git clone -b develop --single-branch $(SPACEMACS_URL) $(EMACSD) ; $(report) "Spacemacs installed"
else
$(report) info "$(EMACSD) already exist. Skipping."
endif
update:
ifeq ($(shell [ -e $(EMACSD) ] $(return_val_truthy) ), false)
$(report) info "Emacs directory doesn't exist."
else ifeq ($(FRAMEWORK), doom)
~/.emacs.d/bin/doom --yes update
~/.emacs.d/bin/doom --yes upgrade
$(report) info "Doom updated"
else
cd $(EMACSD) \
&& git pull \
; $(report) "Spacemacs updated"
endif
remove:
$(info => Removing Emacs config)
@ $(rm_link) $(EMACSD)
@ $(rm_link) $(SPACEMACSD)