LIB_DIR=$(shell pwd)/lib
TARGETS=lib/libmorph_length-prefix.so lib/libmorph_posint.so test

all: $(TARGETS)

lib/libmorph_%.so: src/%.c
	$(CC) -O3 -shared -o $@ -fPIC -Iinclude $<

test: test.c lib/libmorph_length-prefix.so lib/libmorph_posint.so
	$(CC) -O3 -L$(LIB_DIR) -o $@ -Iinclude $< -lmorph_length-prefix -lmorph_posint

clean:
	rm $(TARGETS)

.PHONY: all clean