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
rm_link := $(LIB_DIR)/helper/rm_link
report := LAST_RETURN=$$? $(LIB_DIR)/helper/report
return_val_truthy := && echo true || echo false
cmd_exist = $(shell (($$+commands[$1])) $(return_val_truthy) )

View File

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