CC=gcc
CFLAGS=-std=c11 -Wall -Wpedantic -Iinclude/ -g
LD=gcc
LDFLAGS=-shared -fPIC

TEST_CFLAGS=-std=c11 -Wall -Wpedantic -Iinclude/ -g
TEST_LDFLAGS=-L. -lbbn

libbbn.so: src/bbn.c include/bbn.h
	$(CC) $(CFLAGS) -c -o bbn.o src/bbn.c
	$(LD) $(LDFLAGS) -o $@ bbn.o

test: test/test
	test/test

test/test: test/main.c libbbn.so
	$(CC) $(TEST_CFLAGS) -c -o test/main.o test/main.c
	$(LD) $(TEST_LDFLAGS) -o test/test test/main.o

clean:
	rm -f libbbn.so bbn.o test/test test/main.o

.PHONY: test clean
