# Detect Operating System
OS := $(shell uname)

# Compiler
CXX = g++
CXXFLAGS = -std=c++11 -Wall

# Paths for Homebrew on macOS (Silicon/M1/M2/M3)
ifeq ($(OS), Darwin)
    SFML_DIR = $(shell brew --prefix sfml@2)
    INCLUDES = -I$(SFML_DIR)/include
    LIBS = -L$(SFML_DIR)/lib -lsfml-graphics -lsfml-window -lsfml-system
else
    # Standard Linux paths
    INCLUDES = 
    LIBS = -lsfml-graphics -lsfml-window -lsfml-system
endif

# Target
TARGET = app
SRC = main.cpp

$(TARGET): $(SRC)
	$(CXX) $(CXXFLAGS) $(SRC) -o $(TARGET) $(INCLUDES) $(LIBS)

clean:
	rm -f $(TARGET)