Fixed eager evaluation of conditionals issue.

This commit is contained in:
James Patrick 2019-12-15 00:32:55 -05:00
parent ac0adbdcd2
commit 35000ec4ce
3 changed files with 30 additions and 23 deletions

View File

@ -11,33 +11,36 @@ 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 )
$(report) header "emacs init"
ifneq "$(call cmd_exist,emacs)" "true"
$(report) quite "emacs not installed. Skipping install."
else ifeq "$(IS_SSH)" "true"
$(report) quite "This is a ssh connection. Skipping install."
else
$(info => installing doom.)
$(mk_link) $(SRC_DIR)/doom.d $(DOOMD)
$(MAKE) -C $(SRC_DIR) doom_init
endif
doom_init:
ifeq ($(shell [ ! -e $(EMACSD) ] $(return_val_truthy) ), true)
git clone $(DOOM_URL) $(EMACSD) ; $(report) "Doom installed"
$(report) warn "Doom install is about to start. This will take a minute" ; sleep 3
~/.emacs.d/bin/doom --yes install
~/.emacs.d/bin/doom --yes compile ':core'
else
$(report) info "$(EMACSD) already exist. Skipping."
endif
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" ;\
fi
update:
ifeq ($(shell [ -e $(EMACSD) ] $(return_val_truthy) ), false)
$(report) info "Emacs directory doesn't exist."
else
~/.emacs.d/bin/doom --yes refresh
$(report) info "Doom updated"
endif
if [ -e $(EMACSD)/bin/doom ] ; then \
~/.emacs.d/bin/doom --yes purge ;\
$(report) info "doom purge" ;\
~/.emacs.d/bin/doom --yes refresh ;\
$(report) info "doom refresh" ;\
else \
$(report) debug "doom not setup, so not updating." ;\
fi
remove:
$(info => Removing Emacs config)

View File

@ -3,6 +3,7 @@
R='\033[0;31m'
Y='\033[0;33m'
G='\033[0;32m'
MUTED='\033[0;37m'
NC='\033[0m' # No Color
format(){
@ -10,6 +11,9 @@ format(){
"error") echo -e "$R ✘ $2$NC";;
"warn") echo -e "$Y ⚠ $2$NC";;
"info") echo -e "$G ✔ $2$NC";;
"quite") echo -e "$MUTED כֿ $2$NC";;
"debug") [ -v verbose ] && echo -e "$MUTED כֿ $2$NC" || true ;;
"header") echo -e "=> $2";;
*) echo -e "$1: $2";;
esac
}

View File

@ -27,7 +27,7 @@ endif
IS_MAC?=false
IS_LINUX?=false
IS_SSH=${SSH_TTY}
IS_SSH=$(shell [ ! -z $$SSH_TTY ] $(return_val_truthy) )
# TURN THIS OFF FOR DEBUGGING
MAKEFLAGS += --silent