dotfiles/emacs/makefile

41 lines
1.0 KiB
Makefile

SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SPACEMACSD := ~/.spacemacs.d
EMACSD := ~/.emacs.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
$(info => installing spacemacs.)
$(MAKE) -C $(SRC_DIR) spacemacs_init
$(mk_link) $(SRC_DIR) $(SPACEMACSD)
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) ), true)
cd $(EMACSD) \
&& git pull \
; $(report) "Spacemacs updated"
else
$(report) info "Emacs directory doesn't exist."
endif
remove:
$(info => Removing Emacs config)
@ $(rm_link) $(EMACSD)
@ $(rm_link) $(SPACEMACSD)