CC     = gcc
CFLAGS = -O2 -Wall -Wextra -std=c11

CUBIOMES_SRCS = \
	cubiomes/biomenoise.c \
	cubiomes/biomes.c \
	cubiomes/finders.c \
	cubiomes/generator.c \
	cubiomes/layers.c \
	cubiomes/noise.c \
	cubiomes/quadbase.c \
	cubiomes/terrainnoise.c \
	cubiomes/util.c \
	cubiomes/xradv.c \
	cubiomes/features/abandoned_camp.c \
	cubiomes/features/end_city.c \
	cubiomes/features/fortress.c \
	cubiomes/features/ore.c \
	cubiomes/features/stronghold.c

CUBIOMES_OBJS = $(CUBIOMES_SRCS:.c=.o)

LOG_OBJ = deps/log.c/src/log.o

.PHONY: all clean

all: celseed

celseed: celseed.o $(CUBIOMES_OBJS) $(LOG_OBJ)
	$(CC) -o $@ $^ -lm

celseed.o: celseed.c
	$(CC) $(CFLAGS) -Wno-format-truncation -Wno-stringop-truncation -Wno-misleading-indentation -c -o $@ $<

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

$(LOG_OBJ): deps/log.c/src/log.c
	$(CC) $(CFLAGS) -w -c -o $@ $<

clean:
	rm -f celseed celseed.o $(CUBIOMES_OBJS) $(LOG_OBJ)
