1 # nostr - the shared protocol codecs and primitives.
2 #
3 # Everything here is used by more than one target: the morly relay (native) and
4 # the musiquay web app (wasm). Shared code therefore stays wasm-safe - no os,
5 # no net, no syscalls (pkg/ws is the exception and is native-only; its files
6 # carry a `//:build !wasm` line).
7 8 MOXIE ?= $(CURDIR)/../moxie/moxie
9 # An inherited MOXIEROOT is ignored on purpose: `?=` cannot tell an exported
10 # stale root from an intended one, and a stale root silently compiles a
11 # different tree's src/ and pkg/. Pass it on the command line to build against
12 # another tree: make MOXIEROOT=/path/to/moxie ...
13 ifeq ($(origin MOXIEROOT),environment)
14 MOXIEROOT := $(CURDIR)/../moxie
15 endif
16 MOXIEROOT ?= $(CURDIR)/../moxie
17 18 CAPTURES ?= -allow-closure-captures
19 20 # Every package under pkg/ carrying a *_test.mx, through the compiler's harness.
21 # `moxie test` takes one package at a time.
22 test-unit:
23 @set -e ; for d in $$( find pkg -name '*_test.mx' | xargs -n1 dirname | sort -u ) ; do \
24 echo "=== unit: $$d" ; \
25 MOXIEROOT=$(MOXIEROOT) $(MOXIE) test $(CAPTURES) ./$$d || exit 1 ; \
26 done
27 28 test: test-unit
29 30 .PHONY: test-unit test
31