# Compiler settings
CXX := g++
CXXFLAGS := -std=c++23 -Wall -Wextra -Wpedantic
LDFLAGS := $(shell pkg-config --cflags --libs taglib)

# Source and object files
SRCS := main.cpp src/Tag.cpp src/File.cpp
OBJS := $(SRCS:.cpp=.o)

# Target binary
TARGET := soundServe

# Phony targets
.PHONY: all clean run

# Default target
all: $(TARGET)

# Link object files into final binary
$(TARGET): $(OBJS)
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)

# Compile .cpp files into .o files
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

# Clean build artifacts
clean:
	rm -f $(OBJS) $(TARGET)

# Run the program
run: $(TARGET)
	./$(TARGET)
