SOP = rsop
OFFLINE = 
TARGET = 
TESTS = 

ifdef TARGET
TARGET_OPTION = --target $(TARGET)
else
TARGET_OPTION =
endif


all: sopass.html userguide.html test

sopass.html: sopass.subplot sopass.yaml sopass.md
	subplot docgen sopass.subplot -o sopass.html

userguide.html: doc/userguide.subplot doc/userguide.md
	subplot docgen doc/userguide.subplot -o userguide.html

check:
	cargo clippy ${OFFLINE} ${TARGET_OPTION} --all-targets -- -Dwarnings

build: check
	cargo build ${OFFLINE} ${TARGET_OPTION} --all-targets
	cargo doc ${OFFLINE} ${TARGET_OPTION} --no-deps
	subplot codegen sopass.subplot -o test.py

test: build
	cargo test ${OFFLINE} ${TARGET_OPTION} --all-targets
	cargo test ${OFFLINE} ${TARGET_OPTION} --doc
	rm -f test.log
	SOPASS_LOG=trace python3 test.py --log test.log $(TESTS)
