CC=gcc
WARNINGS := -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
	          -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
	          -Wredundant-decls -Wnested-externs -Winline -Wno-long-long \
	          -Wuninitialized -Wconversion -Wstrict-prototypes
CFLAGS := -g -O -std=c99 $(WARNINGS)

OBJ = posix_lock.o other.o block_header.o sys_alloc.o dmm_init.o custom_malloc.o custom_free.o

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

test: $(OBJ) test.o
	$(CC) -pthread -o $@ $^ $(CFLAGS)

larson: $(OBJ) larson.o
	$(CC) -pthread -o $@ $^ $(CFLAGS)

clean:
	-@$(RM) $(wildcard $(OBJ)) test.o larson.o test larson

.PHONY: all clean test
