CC := cc
CFLAGS := -std=c11 -Wall -Wextra -Wpedantic -Iinclude
TARGET := process_manager
SRC := $(wildcard src/*.c)
OBJ := $(SRC:.c=.o)
DEP := $(OBJ:.o=.d)

.PHONY: all clean run server webui test benchmark

all: $(TARGET)

$(TARGET): $(OBJ)
	$(CC) $(CFLAGS) -o $@ $(OBJ)

src/%.o: src/%.c
	$(CC) $(CFLAGS) -MMD -MP -c $< -o $@

run: $(TARGET)
	./$(TARGET)

server: $(TARGET)
	python3 webui_server.py

webui: server

test: $(TARGET)
	python3 tests/run_tests.py

benchmark: $(TARGET)
	python3 scripts/benchmark_report.py

clean:
	rm -f src/*.o src/*.d $(TARGET)

-include $(DEP)
