# Rosenblatt npu-probe — host build + structural self-test.
# `make test` needs no libdrm; `make lib` builds the ioctl wrapper (needs libdrm-dev).
CC     ?= gcc
CFLAGS ?= -Wall -Wextra -O2

EMIT_OBJS = rkt_matmul_cna.o rkt_matmul_coredpu.o rkt_matmul.o rkt_gemm.o

.PHONY: all test lib clean
all: selftest

selftest: selftest.o $(EMIT_OBJS)
	$(CC) $(CFLAGS) -o $@ $^

# The DRM/ioctl wrapper is compiled separately — it pulls in <drm/...> headers.
lib: librocket.o
librocket.o: librocket.c
	$(CC) $(CFLAGS) -I/usr/include/drm -c -o $@ $<

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

test: selftest
	./selftest

clean:
	rm -f *.o selftest
