# Makefile for Java Project

# Variables
SRC_DIR := src
BUILD_DIR := build
PARTITION_CLASS := src/CGPartitioning
JAVA_FILES := $(SRC_DIR)/*.java
# Targets
.PHONY: all compile run clean help

all: run

compile:
	@echo "Compiling Java files..."
	mkdir -p $(BUILD_DIR)
	javac -d $(BUILD_DIR) $(JAVA_FILES)

run:
	@echo "Running the Java project..."
	java -cp $(BUILD_DIR) $(PARTITION_CLASS) $(ARGS)

clean:
	@echo "Cleaning up compiled files..."
	rm -rf $(BUILD_DIR)

help:
	@echo "Available commands:"
	@echo "  make compile	\n\t- Compile the Java files.\n"
	@echo "  make run ARGS='pointsWithCharge1MYK.txt controlPoints1MYK.txt'	\n\t- Run the Java project.\n"
	@echo "  make clean	\n\t- Remove all compiled .class files.\n"
	@echo "  make help	\n\t- Show this help message.\n"
	@echo "  make compare ARGS1=file_one ARGS2=file_two	\n\t- Compare two files outputs.\n"

compare:
	git diff --no-index -- $(ARGS1) $(ARGS2)
