# Host tests for main/can_rxbuf.c, which of comm_can's reassembly buffers a
# multi-frame packet goes into.
#
#   nix-shell -p gcc gnumake --run 'cd tests/can_rxbuf && make && ./test_can_rxbuf'
#
# test_can_rxbuf.c is bldc's tests/can_rxbuf/main.c unchanged, since
# can_rxbuf.c is byte-identical between the two firmwares.

CFLAGS += -O1 -g -std=gnu99 -Wall -Wextra
SAN ?= -fsanitize=address,undefined -fno-omit-frame-pointer

MAIN = ../../main

SRCS = test_can_rxbuf.c $(MAIN)/can_rxbuf.c
HDRS = $(MAIN)/can_rxbuf.h

all: test_can_rxbuf

test_can_rxbuf: $(SRCS) $(HDRS)
	$(CC) $(CFLAGS) $(SAN) -I$(MAIN) $(SRCS) -o $@

clean:
	rm -f test_can_rxbuf

.PHONY: all clean
