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

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

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



# Target
TARGET = basic1_emulator
SRC = main.cpp low_level_display_sfml.cpp input_manager.cpp game_launcher.cpp \
    ../display/low_level_render.cpp \
    ../display/low_level_gui.cpp \
    ../games/demo_game.cpp \
    ../games/tic_tac_toe.cpp \
    ../games/monopoly/monopoly_game.cpp \
    ../games/monopoly/player.c

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

clean:
	rm -f $(TARGET)