Cleaned up makefile

This commit is contained in:
James Patrick 2019-12-15 01:37:19 -05:00
parent 35000ec4ce
commit 3b9211202a
3 changed files with 14 additions and 8 deletions

View File

@ -11,6 +11,7 @@ LIB_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
mk_link := $(LIB_DIR)/helper/mk_link mk_link := $(LIB_DIR)/helper/mk_link
rm_link := $(LIB_DIR)/helper/rm_link rm_link := $(LIB_DIR)/helper/rm_link
report := LAST_RETURN=$$? $(LIB_DIR)/helper/report report := LAST_RETURN=$$? $(LIB_DIR)/helper/report
return_val_truthy := && echo true || echo false return_val_truthy := && echo true || echo false
cmd_exist = $(shell (($$+commands[$1])) $(return_val_truthy) ) cmd_exist = $(shell (($$+commands[$1])) $(return_val_truthy) )

View File

@ -7,6 +7,7 @@ include ../lib/shared.mk
install: | init update install: | init update
init: init:
$(info => tmux init)
ifeq ($(call cmd_exist,tmux), true) ifeq ($(call cmd_exist,tmux), true)
$(info => Setting up tmux) $(info => Setting up tmux)
$(mk_link) $(SOURCE) $(TARGET) $(mk_link) $(SOURCE) $(TARGET)

View File

@ -1,24 +1,28 @@
SRC := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
include ../lib/shared.mk include ../lib/shared.mk
TARGET := $(XDG_DIR)/tridactyl RC_TARGET := $(XDG_DIR)/tridactyl
SCRIPTS_TARGET := ~/.local/share/tridactyl/scripts SCRIPTS_TARGET := ~/.local/share/tridactyl/scripts
install: | init update install: | init update
init: init:
ifeq ($(shell $(call cmd_exist,firefox) || $(IS_MAC) ; echo $$? ), 0) $(info => setting up Tridaycl)
$(info => Setting up Tridacyl) ifeq "$(IS_MAC)" "true"
$(mk_link) $(SRC) $(TARGET) $(MAKE) -C $(SRC_DIR) setup
$(mk_link) $(SRC)/scripts $(SCRIPTS_TARGET) else ifeq "$(call cmd_exist,firefox)" "true"
$(MAKE) -C $(SRC_DIR) setup
else else
$(report) warn "This doesn't seem to be an env for Tridactyl. Skipping." $(report) warn "This doesn't seem to be an env for Tridactyl. Skipping."
endif endif
setup:
$(mk_link) $(SRC_DIR) $(RC_TARGET)
$(mk_link) $(SRC_DIR)/scripts $(SCRIPTS_TARGET)
update: update:
remove: remove:
$(info => Remvoing tridactyl ) $(info => Remvoing tridactyl )
$(rm_link) $(TARGET) $(rm_link) $(RC_TARGET)
$(rm_link) $(SCRIPTS_TARGET) $(rm_link) $(SCRIPTS_TARGET)