CXX = g++
CXXFLAGS = -O3 -std=c++17 -pthread
TARGET = lab2
OUT_DIR = out

all: $(TARGET)

$(TARGET): main.cpp
	$(CXX) $(CXXFLAGS) main.cpp -o $(TARGET)

run_all: $(TARGET)
	@mkdir -p $(OUT_DIR)/{pics,logs}
	@echo "1. Generating Timelines (Logs and Pics into $(OUT_DIR)/)..."
	# Запуск и перенаправление логов в out/
	./$(TARGET) 1000 2 10 > $(OUT_DIR)/logs/log_t2.txt
	./$(TARGET) 1000 4 10 > $(OUT_DIR)/logs/log_t4.txt
	# Генерация графиков из логов в out/pics/
	python3 exporter.py $(OUT_DIR)/logs/log_t2.txt $(OUT_DIR)/pics
	python3 exporter.py $(OUT_DIR)/logs/log_t4.txt $(OUT_DIR)/pics

	@echo "2. Generating Efficiency Benchmark..."
	python3 benchmark.py

clean:
	rm -rf $(TARGET) $(OUT_DIR)
