# Disable built-in implicit rules to prevent circular dependency warnings
MAKEFLAGS += -r

SC=../../target/debug/compiler
CC=gcc
LIBS=-lm

S_SOURCES=$(wildcard *.src)
C_SOURCES=$(wildcard *.c)
SOURCES=$(S_SOURCES) $(C_SOURCES)
OBJECTS=$(SOURCES:%=%.o)

.PHONY: clean

raytracer: $(OBJECTS)
	$(CC) $(LIBS) -o raytracer $^

%.src.o: %.src
	$(SC) -o $@ $<

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

clean:
	rm -f $(OBJECTS) raytracer
