# SPDX-License-Identifier: MIT # # TurboQuant-Elyan test targets. # # make test build and run the suite for this machine # make test-vsx build for POWER8 VSX (needs -mcpu=power8; run under # qemu-ppc64le-static when cross-compiling) # make selftest run tq3_self_test() on its own # # The header lives at the repository root, so the tests need -I. — building # tests/test_turboquant_vsx.c without it fails on the first #include. CC ?= cc CFLAGS ?= -O2 -std=c11 -Wall -Wextra VSXFLAGS ?= -mcpu=power8 -mvsx -maltivec LDLIBS ?= -lm BUILD := build .PHONY: test test-vsx selftest clean $(BUILD): mkdir -p $(BUILD) $(BUILD)/test_turboquant: tests/test_turboquant_vsx.c ggml-turboquant-vsx.h | $(BUILD) $(CC) $(CFLAGS) -I. -o $@ $< $(LDLIBS) $(BUILD)/test_turboquant_vsx: tests/test_turboquant_vsx.c ggml-turboquant-vsx.h | $(BUILD) $(CC) $(CFLAGS) $(VSXFLAGS) -I. -o $@ $< $(LDLIBS) $(BUILD)/selftest.c: | $(BUILD) printf '#include "ggml-turboquant-vsx.h"\nint main(void){return tq3_self_test();}\n' > $@ $(BUILD)/selftest: $(BUILD)/selftest.c ggml-turboquant-vsx.h $(CC) $(CFLAGS) -I. -o $@ $< $(LDLIBS) test: $(BUILD)/test_turboquant ./$< test-vsx: $(BUILD)/test_turboquant_vsx @echo "built $< — run it on POWER8, or: qemu-ppc64le-static $<" selftest: $(BUILD)/selftest ./$< clean: rm -rf $(BUILD)