Ex32: Linker issues when building the tests

I have created the lcthw file structure as described by Zed and can successfully build the ‘o’, ‘.a’, and ‘.so’ files.
When I try to build and run my tests, primarily list_tests.c, I get a build error.
It appears that the directive to "#include <lcthw/lists.h> in the tests/list_tests.c is not linking correctly.

As always a picture is worth a 1000 words:

This is what the test section of my Makefile looks like:

The unit tests

.PHONY: tests
tests: CFLAGS += $(TARGET)
tests: $(TESTS)
sh ./tests/runtests.sh

with the CFLAGS being:
CFLAGS=-g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)

Any assistance is appreciated!

Solution:
If running Linux then include this in the Makefile

OS=$(shell uname -a)
ifeq (Linux,$(findstring Linux,$(OS)))
LDLIBS=-llcthw -lbsd -L./build -lm
endif

If linking with dynamic libraries, and running the tests on them, include these additional flags:

The unit tests

.PHONY: tests

tests: CFLAGS += $(TARGET) -Wl,–no-as-needed -ldl

tests: $(TESTS)

sh ./tests/runtests.sh

PSA: I’m shutting down this forum so please direct future help requests to the Discord or help@learncodethehardway.com.