From 3b9211202aa455daab4e9b7445fcc84d248fa761 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sun, 15 Dec 2019 01:37:19 -0500 Subject: [PATCH] Cleaned up makefile --- lib/shared.mk | 1 + tmux/makefile | 1 + tridactyl/makefile | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/shared.mk b/lib/shared.mk index 814b36c..d587a76 100644 --- a/lib/shared.mk +++ b/lib/shared.mk @@ -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) ) diff --git a/tmux/makefile b/tmux/makefile index 90e2283..2f26472 100644 --- a/tmux/makefile +++ b/tmux/makefile @@ -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) diff --git a/tridactyl/makefile b/tridactyl/makefile index 0b3c792..0b2178e 100644 --- a/tridactyl/makefile +++ b/tridactyl/makefile @@ -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)