tree-mumu 0.1.0-rc.2

Creates Linux `tree`-style renderings of MuMu values
Documentation
# Makefile — build & install the MuMu "tree" plugin
# ------------------------------------------------------------------------
# Usage:
#   make                # debug (native)
#   make release        # release (native)
#   make install        # install release .so/.dylib to /usr/local/lib and ldconfig
#   make uninstall      # remove installed library
#   make print-target
#   make print-features
#
# Environment:
#   FEATURES="host"     # enable host-only features (if any). Recommended for native.
#   TARGET_TRIPLE=...   # e.g. aarch64-apple-darwin, x86_64-unknown-linux-gnu
# ------------------------------------------------------------------------

PLUGIN := tree

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
  DLL      := dylib
  LDCONFIG := true
else
  DLL      := so
  LDCONFIG := ldconfig
endif

TARGET_LIB := libmumu$(PLUGIN).$(DLL)
PREFIX    ?= /usr/local
LIBDIR    ?= $(PREFIX)/lib
CARGO     ?= cargo
FEATURES  ?= host

ifdef TARGET_TRIPLE
  TARGET_FLAG := --target $(TARGET_TRIPLE)
  OUTDIR_DBG  := target/$(TARGET_TRIPLE)/debug
  OUTDIR_REL  := target/$(TARGET_TRIPLE)/release
else
  TARGET_FLAG :=
  OUTDIR_DBG  := target/debug
  OUTDIR_REL  := target/release
endif

.PHONY: all debug release install install-debug uninstall clean print-target print-features

all: debug

debug:
	$(CARGO) build $(TARGET_FLAG) --features "$(FEATURES)"

release:
	$(CARGO) build $(TARGET_FLAG) --release --features "$(FEATURES)"

install: release
	@echo "Installing $(TARGET_LIB) to $(LIBDIR)"
	sudo install -m 0755 $(OUTDIR_REL)/$(TARGET_LIB) $(LIBDIR)/$(TARGET_LIB)
	-@$(LDCONFIG)

install-debug: debug
	@echo "Installing (debug) $(TARGET_LIB) to $(LIBDIR)"
	sudo install -m 0755 $(OUTDIR_DBG)/$(TARGET_LIB) $(LIBDIR)/$(TARGET_LIB)
	-@$(LDCONFIG)

uninstall:
	@echo "Removing $(LIBDIR)/$(TARGET_LIB)"
	- sudo rm -f $(LIBDIR)/$(TARGET_LIB)
	-@$(LDCONFIG)

clean:
	$(CARGO) clean

print-target:
	@echo $(TARGET_LIB)

print-features:
	@echo $(FEATURES)