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)