INSTALL_PATH ?= $(HOME)/opt/libexec
GIT_ROOT = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
GADGETS_VERSION = $(shell cargo run -- --version | awk '{ print $$NF }')
T16 := t16
T16G := t16g
T16P := t16p
INSTALL_PATH ?= $(HOME)/opt/libexec
anybuilt = $(let G,$1,$(firstword $(wildcard target/*/$(G)) target/debug/$(G)))
t16 = $(let in,$(T16),$(call anybuilt,$(in)))
t16g = $(let in,$(T16G),$(call anybuilt,$(in)))
t16p = $(let in,$(T16P),$(call anybuilt,$(in)))
install: release
install target/release/$(T16) $(INSTALL_PATH)/$(T16)
install target/release/$(T16G) $(INSTALL_PATH)/$(T16G)
install target/release/$(T16P) $(INSTALL_PATH)/$(T16P)
debug release:
cargo build $(patsubst release,--quiet,$(patsubst debug,,$@)) $(patsubst release,--release,$(patsubst debug,,$@))
test: debug release
$(t16p) $$($(t16g))
.PHONY: install debug release test