array-mumu 0.2.0-rc.2

Array tools plugin for the Mumu ecosystem
Documentation
# Makefile — build & install the MuMu "array" plugin
# ------------------------------------------------------------------------
# Defaults:
#   - Native (.so/.dylib) builds should export the dynamic entrypoint
#     `Cargo_lock` so extend("array") works in host/CLI builds.
#   - The plugin now guards that symbol behind the `host` feature, so we
#     DEFAULT to `FEATURES=host` here.  For WASM/static linking, override:
#         make release FEATURES=""
#   - You can also pass any other crate features via FEATURES.
# ------------------------------------------------------------------------

PLUGIN := array

# Detect platform-specific dynamic library suffix and ldconfig availability
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
  DLL      := dylib
  LDCONFIG := true
else
  DLL      := so
  LDCONFIG := ldconfig
endif

TARGET   := libmumu$(PLUGIN).$(DLL)
PREFIX  ?= /usr/local
LIBDIR  ?= $(PREFIX)/lib

# Build-time features:
#  - Default to 'host' so the cdylib exports Cargo_lock for extend("array").
#  - For WASM/static use: make release FEATURES=""
FEATURES ?= host

CARGO   ?= cargo

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

all: debug

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

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

install: release
	sudo install -m 0755 target/release/$(TARGET) $(LIBDIR)/$(TARGET)
	@# If ldconfig isn't available (e.g. macOS), this no-ops due to LDCONFIG=true
	sudo $(LDCONFIG)

install-debug: debug
	sudo install -m 0755 target/debug/$(TARGET) $(LIBDIR)/$(TARGET)
	sudo $(LDCONFIG)

uninstall:
	sudo rm -f $(LIBDIR)/$(TARGET)
	sudo $(LDCONFIG)

clean:
	$(CARGO) clean

print-target:
	@echo $(TARGET)

print-features:
	@echo $(FEATURES)