core/Makefile

name=core

CFLAGS= -g \
	$(shell pkg-config --cflags sdl3) \
	$(pkg-config --cflags sdl3-ttf)

LDFLAGS= \
	$(shell pkg-config --libs sdl3) \
	$(shell pkg-config --libs sdl3-ttf)

srcs=$(shell find src -name '*.c')
objs=$(srcs:%.c=build/%.o)
deps=$(objs:.o=.d)

./build/$(name): $(objs)
	$(CC) $(objs) -o $@ $(LDFLAGS)

./build/%.o: %.c
	mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -MMD -MP -c $< -o $@

.PHONY: clean
clean:
	rm -rf build

-include $(deps)