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

View File

@ -3,6 +3,7 @@
R='\033[0;31m' R='\033[0;31m'
Y='\033[0;33m' Y='\033[0;33m'
G='\033[0;32m' G='\033[0;32m'
MUTED='\033[0;37m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
format(){ format(){
@ -10,6 +11,9 @@ format(){
"error") echo -e "$R ✘ $2$NC";; "error") echo -e "$R ✘ $2$NC";;
"warn") echo -e "$Y ⚠ $2$NC";; "warn") echo -e "$Y ⚠ $2$NC";;
"info") echo -e "$G ✔ $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";; *) echo -e "$1: $2";;
esac esac
} }

View File

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