# Makefile for main and solver

# Compiler and flags
CC = gcc
CFLAGS = -O2 -Wall -Wextra -I$(INC_DIR)

# Include directory for circuit.h
INC_DIR = ../ode-sim

# Targets
main: main.o fsm.o fp.o debug.o memory.o
	$(CC) $(CFLAGS) -o $@ $^

main.o: main.c fsm.c fsm.h fp.c fp.h memory.c memory.h debug.c debug.h
	$(CC) $(CFLAGS) -c $< -o $@

fsm.o: fsm.c fsm.h memory.c memory.h
	$(CC) $(CFLAGS) -c $< -o $@

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

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

debug.o: debug.c debug.h memory.c memory.h fsm.c fsm.h fp.c fp.h
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f main main.o solver.o